如何访问IFRAME里的元素
如果让test函数可以正常执行呢
刚才测试过如果iframe的src和本网页是一个域内则可以正常执行.但问题是我IFRAME是外网站的,请问有没什么设置可以对IFRAME里是外网站的情况进行控件赋值呢?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function test()
{
//alert(main.document.getElementById('from').value);
main.document.getElementById('from').value='东街口啊';
return;
//alert(document.frames["main"].document.all["username"].value)
//document.frames["main"].document.all["username"].value = "username";
//document.frames["main"].document.all["password"].value = "fc";
}
</script>
</head>
<body>
<input type="button" name="Submit" value="按钮" onclick="test();" />
<iframe src="http://so.fzs8.com/bus.asp" width="100%" height="100%" id="main" name="main"></iframe>
</body>
</html>