私は2つのhtmlページを持っています.1つはparent.htm
child.htmlparent.htm child.html`でchild.html
指定href
した場所です.ここに私の2つのファイルがありますparent.htm' to
, here i have to access the elements of
in
親.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>
前もって感謝します