我有两个 html 页面一个是parent.htm
另一个是child.html
我href
在parent.htm' to
child.html , here i have to access the elements of
parent.htm in
child.html`中给出的,这是我的两个文件
父.htm
<!DOCTYPE html>
<html>
<body>
<form>
<input id=text1 type=text name="test2">
<a href="child.html" target="_self">Open kid</a>
</form>
</body>
</html>
child.html
<html>
<script type="text/javascript">
function parent(){
//here i want to access values from parent.htm page, but does not work
var value = parent.getElementById('text1').value;
var value2=top.getElementById('text1').value;
alert(value);
}
</script>
<body onload="parent()">
<form>
</form>
</body>
</html>
提前致谢