我正在尝试以按钮的值为基础重定向我的窗口,但我可以工作
这是我的代码
<!DOCTYPE html>
<html>
<body>
<p>Click the button to change the location of the first iframe element (index 0).</p>
<button class="godd" onclick="myFunction()">Try it</button>
<br>
<br>
<iframe src="http://localhost:8005/?xform=http://127.0.0.1:8080/output_path4fff"></iframe>
<iframe src="http://localhost:8005/?xform=http://127.0.0.1:8080/output_path4fff"></iframe>
<script src="http://code.jquery.com/jquery-1.11.0.min.js">
$(document).ready(myFunction() {
var Vp = $('.godd').eq(0).text();
window.frames[0].top.location.href = 'http://' + Vp;
})
</script>
</body>
</html>
请帮忙
jQuery代码应如下所示:
function myFunction() { /* myfunction declaration */
var Vp = $('.godd').eq(0).text();
window.frames[0].top.location.href = 'http://' + Vp ;
};
$(document).ready(function(){ /* DOM ready callback */
});
您应该在DOM之外准备好定义函数。阅读$ {document).ready
您的脚本标签应如下所示:
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
//Jquery Code
</script>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句