我有以下的html:jQuery的 - 一个iframe里面的脚本代码无法更新iframe的内容
<html>
<head></head>
<body>
<form>
<input id="msg" type="text" value="oldValue" />
</form>
<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script>
$().ready(function() {
var m = $("#msg");
alert(m.val()); // returns oldValue
m.val("newValue"); // this doesn't make the browser show newValue instead of oldValue
alert(m.val()); // returns newValue
// and in the end, the browser still shows oldValue for the input
});
</script>
</body>
</html>
此代码运行完美,但是当置于facebox(这只是创建一个iframe并显示它像一个浮动窗口),代码无法更新输入的内容。
父母也有jQuery,但不应该影响我猜测的任何东西。
任何想法为什么它失败?
你是否试过让实际的DOMElement而不是使用jQuery的方法来做到这一点? – geowa4 2009-08-19 17:31:21