3
我有一个iframe和一个表单。表单的目标是iframe。当我提交表单时,结果页面应该加载到iframe中。我附上下面的代码:jquery表单提交()回调不起作用
<html>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript">
function submitForm() {
$("form#testForm").submit(function(){
alert('hii')
});
}
</script>
</head>
<body>
<iframe name="testFrame" id="testFrame" frameborder="1" scrolling="no" width="500" height="200"></iframe>
<form name="testForm" id="testForm" action="http://www.yahoo.com" target="testFrame"> </form>
<button name="testBtn" value="submit" onclick="submitForm();">submit</button>
</body>
</html>
警报不来了....请帮助我......
日Thnx outis ......这是工作,现在... :-) – Aneesh 2010-04-06 10:36:31
一件事...我怎样才能加载页面的内容高度? $(“#iframeName”)。contents()。find(“body”)。height()不工作...任何想法?它给出0 ... :( – Aneesh 2010-04-06 10:56:51
@Aneesh:SO是一个问答网站,而不是论坛。新问题应该作为新问题提出,而不是在评论中。你的代码不起作用的原因,简而言之(因为这是全部该评论允许),是iframe的内容是在不同的领域,所以你不能。 – outis 2010-04-06 22:01:36