<html><head>
<title>Welcome</title>
<style type="text/css"></style></head>
<frameset border="false" frameborder="O" framespacing="0" rows="0,*" cols="*">
<frame marginwidth="0" marginheight="0" name="frame_rsafp" src="rsa_flash_cookie.html" noresize="true" scrolling="no">
<frameset border="false" frameborder="O" framespacing="0" rows="*,30" cols="*">
<frame marginwidth="0" marginheight="0" name="login_page" noresize="true" scrolling="yes">
#document
<html>
<form name="frmLogin" action="entry" class="login" method="post" target="_top" autocomplete="off">
<span class="passfield">
<input type="text" name="LoginUserId" onkeypress="return fSubmit(event);" value="" class="ipassword">
</span>
</form>
</html>
<frame marginwidth="0" marginheight="0" name="footer" src="footer.html" noresize="true" scrolling="no">
</frameset>
</frameset>
</html>
对于上面的html代码,我想将值设置为文本字段“LoginUserId”。 我试过 document.getElementsByName("LoginUserId")[0].value = "MyValue";
但它返回错误无法设置未定义的属性'值'。 我只能得到元素高达“login_page”和“login_page”子元素的计数返回。如何从嵌套<html>文件中获取元素?
var ele = document.getElementsByName("login_page")[0].childNodes;
alert(ele.length);
如何获取此嵌套html文档的元素?
完美。感谢您的快速回答。 – Eplzong