Sayfada iframe ile video çağırıyorum.
2 adet video link seceneğim var.
1 buton ile çağrılan videoyu bir ona bir diğerine değiştirmek istiyorum.
Nasıl yapılabilir?
İşinizi görebilir hocam: http://gokhanbeken.com/jquery-ile-kitabin-ortasindan-1 (http://gokhanbeken.com/jquery-ile-kitabin-ortasindan-1)
örnek:
<SCRIPT LANGUAGE="JavaScript">
function degistir(var yeniAdres){
document.getElementById('videoAlani').src = yeniAdres;
}
</script>
<iframe id="videoAlani" src="about:blank" width="500" height="500"></iframe>
<button onclick="degistir('https://www.picproje.org')">İlk video</button>
<button onclick="degistir('http://www.google.com')">İkinci video</button>
Çalıştıramadım.
Şu javascriptsiz kodu çalıştırabildim,
http://www.webdeveloper.com/forum/showthread.php?81962-Using-a-button-for-iframe (http://www.webdeveloper.com/forum/showthread.php?81962-Using-a-button-for-iframe)
<input type="button" onclick="test.location.href='http://www.wthrman.com/nswsc/newprogwx.html';document.getElementById('test').frameBorder=1" value="Click Here">
<input type="button" onclick="test.location.href='blank.html';document.getElementById('test').frameBorder=0" value="Clear">
<iframe src="blank.html" frameborder="0" name="test" id="test" width=1200 height=800></iframe>
çok kullanışlı pratik bir ajax uygulaması var Abi http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/ (http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/)
html, inframe ,resim vb hepsinde çalışıyor
AJAX'ı duyuyordum ama bu işlerle pek ilgim olmadığından ne olduğuna bile bakmamıştım. Hakkaten enteresan bir yapı imiş.
@meftun'un örnek sade ve temiz fakat,
"function degistir(var yeniAdres){" yerine "function degistir(yeniAdres){" olması gerekiyor.
JavaScript function definitions do not specify data types for parameters.
bkz: JavaScript Function Parameters (http://www.w3schools.com/js/js_function_parameters.asp)