我遇到AHAH Jquery方法load()的问题。我想点击表格中的链接后
<table class="table table-hover" style="background: white;">
<tbody>
<tr>
<td><a title="Dominikana" href="../../oferty-hotelowe/tajlandia"><img src="../../upload/getbyid/175094/Thailand-Flag-icon (1).png" alt="Dominikana"></a></td>
<td><a title="Dominikana" href="../../oferty-hotelowe/tajlandia">Tajlandia</a></td>
<td class="arrow"><a title="Dominikana" href="../../oferty-hotelowe/tajlandia">></a></td>
</tr>
链接应该在iframe中打开,但它不起作用,只会弹出警报。
<iframe id="64704528" src="" width="100%" height="720"></iframe>
var $widget = $(".table-hover");
$widget.find("a").on('click', function(e) {
e.preventDefault;
var $frame = $("iframe#64704528");
$frame.load("http://comfort31.traffics-ibe.com/tibet.php?target=%2Fuslugi%2Fzakwaterowanie%2F&ixp=hotel&typ=H&cfg=0080017030000000&stp=2&rmask=1&hmask=2&tps=t5&xP=0000%2B0000&lng=pl&dsi=ALLE&opi=&htn=&vnd = 20.05.2011 & BSD = 20 czerwca 2011 i EPC = 2-enc = UTF-8-NTC = 1", function() {
alert( "Load was performed." );
});
});
答案 0 :(得分:-1)
.load()
用于设置元素的HTML,但不能将HTML直接放入iframe。您应该将src
设置为指向网址。
$frame.attr("src", "http://comfort31.traffics-ibe.com/tibet.php?target=%2Fuslugi%2Fzakwaterowanie%2F&ixp=hotel&typ=H&cfg=0080017030000000&stp=2&rmask=1&hmask=2&tps=t5&xP=0000%2B0000&lng=pl&dsi=ALLE&opi=&htn=&vnd = 20.05.2011 & BSD = 20 czerwca 2011 i EPC = 2-enc = UTF-8-NTC = 1")
.on("load", function() {
alert("Load was performed.");
});