I want the button on the second page to change the value of the button in the first page,this is my code:
FILE 1: Index.html (page one):
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Eran Exercise</title>
<link rel="stylesheet" type="text/css" href="design.css" />
<script src="new_file.js"></script>
</head>
<body>
<div class="wrapper">
<form>
<input type="button" id="id200" value="New Window!" onClick="window.open( page2.html , mywindow , width=400,height=200 )">
</form>
</div>
</body>
</html>
FILE2:new_file.js(js file)
function changeLink()
{
var someOtherName="after click";
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("id200").value = someOtherName;
}
}
xmlhttp.open("GET","index.php");
xmlhttp.send();
}
FILE 3:page2.html (page two)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<script src="new_file.js"></script>
</head>
<body>
<input type="button" id="id100" onclick="changeLink()" value="Change link">
</body>
</html>
感谢!