日期:2014-05-16 浏览次数:20437 次
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<frameset rows="90,*" frameborder="no" border="0" framespacing="0">
<frame name="topFrame" src="test1.htm" frameborder="0" border="0" scrolling="auto">
<frame name=""mainFrame" src="http://xxx.com/login" frameborder="0" border="0" scrolling="auto">
</frameset>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language=JavaScript>
window.onload=function(){
top.mainFrame.document.loginform.Username.value='用户名';
top.mainFrame.document.loginform.Password.value='密码';
top.mainFrame.document.loginform.submit();
}
</script>
</head>
<body>
</body>
</html>
window.onload=function(){
var iframe = document.getElementById("mainFrame");
iframe.onload = function() {
var iframeDoc = iframe.contentDocument
------解决方案--------------------
iframe.contentWindow.document;
iframeDoc.loginform.Username.value='用户名';
iframeDoc.loginform.Password.value='密码';
iframeDoc.loginform.submit();
}
}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<frameset rows="90,*" frameborder="no" border="0" framespacing="0">
<frame name="topFrame" src="test1.htm" frameborder="0" border="0" scrolling="auto">
<frame name="mainFrame" id='mainFrame' src="http://xxx.com/login" frameborder="0" border="0" scrolling="auto">
</frameset>
</html>