0
<script language=JavaScript>
winRef = new Object();
winRef.closed = true;
</script>

<form name=f1 id=f1>
<input type=button name=b1 id=b1 value="New window" 
onClick="winRef=window.open('http://www.google.com/','myNewWindow',
  'left=15,top=15,width=510,height=420,toolbar=1,menubar=1,resizable=1,status=1');
  winRef.focus()">

<input type=button name=b2 id=b2 value="Close the window" 
onClick="if(!winRef.closed)winRef.close();">

<input type=button name=b3 id=b3 value="Check: is it closed?" 
onClick="alert(winRef.closed ? 'It\'s CLOSED!':'It\'s still OPEN!');">

<input type=button name=b4 id=b4 value="Change new window URL" 
onClick="winRef.location.href('http://example.com/' + winRef.location.href)">
</form>

このコードは新しいウィンドウでGoogleを開き、開いているかどうかを確認して閉じます。その名前を「 http://example.com/?url=http://www.google.com/ 」に変更するにはどうすればよいですか?開いているウィンドウの URL の前に自分のサイトの URL を配置する必要があります

4

1 に答える 1