Reply
Wed 19 Dec, 2012 02:13 am
This question is javascript.
Parent window(tab) link to child windw(tab).
then child window(tab) will link to parent window(tab).
I writed code.
My code can run only chrome.
My code can't run ie9 and firefox 4.
Ask idea to run my code ie9 and firefox 4.
below my code.
1.Parent<index.html>
<html>
<head>
<title>TOP page</title>
<script type="text/javascript">
<!--
var win;
function disp(url){
win = window.open(url, "pa");
}
// -->
</script>
</head>
<body>
<p><a href="example_sub8.html" target="_blank" onClick="disp('example_sub8.html')">open sub window</a></p>
</body>
</html>
<example_sub8.html>
<html>
<head>
<title>test sub window</title>
<script type="text/javascript">
<!--
function disp(url){
if(!window.opener || window.opener.closed){
window.alert('Main Window not exist');
}
else{
window.blur();
window.opener.focus();
window.open(url,"pa");
//window.opener.location.href = url;
}
}
// -->
</script>
</head>
<body>
<ul>
<li><a href="#" onClick="disp('index.html'); return false;">top page</a></li>
<li><a href="#" onClick="disp('index2.html'); return false;">test2 page</a></li>
</ul>
</body>
</html>