I\'m struggling to implement this case, I really appreciate your help.
UPDATE :
page1.html
First of all javascript is case sensetive, and n
is missing. so replace getElemetByID
with getElementById
.
Second is that the code executes immediately and doesn't wait the page to load. You must wrap your code in window.onload
:
newWindow.onload = function(){
newWindow.document.getElementById('one').value='xxx';
}
there's 3 bugs in the update:
function
in detailsWindow.onload = function
must be declared with detailsWindow.onload = function()
to work.<script>
to </script>
detailsWindow
in document.getElementById('one').value = 'test';
it must be detailsWindow.document.getElementById('one').value = 'test';
// page1.html
<script>
var newWindow = window.open('page2.html', 'formUntukUpdate', 'width=400,height=350');
newWindow.onload = function(){
newWindow.document.getElementById('one').value = 'ok 2';
};
</script>
// page2.html
<input type="text" id="one" value="ok" />