B
Bowen Simmons
OK. I have a test html page:
"To.html":
<html>
<head>
<title>To</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="JavaScript">
function Go(aString)
{
alert(aString);
return false;
}
</script>
</head>
<body>
<a href="" id="T1" onclick="return window.Go(id);"> <p>T1
anchor</p></a>
<a href="" id ="T2" onclick="return window.Go(id);"> <p>T2
anchor</p></a>
</body>
</html>
</html>
If I press on either the "T1" or the "T2" link, it brings up an alert
with the text set to either "T1" or "T2". Life is good so far.
Now, I use a second window to open the page:
"From.html"
<html>
<head>
<title>From</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="JavaScript">
function Go(aString)
{
var vMapWindow = window.open("To.html", "CurrentMap");
vMapWindow.focus();
vMapWindow.Go(aString);
return false;
}
</script>
</head>
<body >
<a href="T1" id="T1" onclick="return window.Go(id)"> <p>T1
anchor</p></a>
<a href="T2" id="T2" onclick="return window.Go(id)"> <p>T2
anchor</p></a>
</body>
</html>
When I press either the "T1" or "T2" links on the "From.html" page,
what is supposed to happen is that the browser is supposed to open a
new window showing "To.html" (which it does), give it the focus (which
it does even without the focus() call, but as I understand it browsers
are not consistent here), and then call the Go() method in the new
window showing "To.html" which should bring up the alert. It doesn't
do this however. In fact, it seems to throw an exception instead,
causing the "From.html" window to attempt to navigate to the
non-existent "T1" or "T2" page.
I am testing this with Safari, but have also tried Firefox and even
old Mac IE 5, and all of them fail the same way so I assume this is
not a browser problem, but a mistake on my part. Anybody know what my
mistake is?
"To.html":
<html>
<head>
<title>To</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="JavaScript">
function Go(aString)
{
alert(aString);
return false;
}
</script>
</head>
<body>
<a href="" id="T1" onclick="return window.Go(id);"> <p>T1
anchor</p></a>
<a href="" id ="T2" onclick="return window.Go(id);"> <p>T2
anchor</p></a>
</body>
</html>
</html>
If I press on either the "T1" or the "T2" link, it brings up an alert
with the text set to either "T1" or "T2". Life is good so far.
Now, I use a second window to open the page:
"From.html"
<html>
<head>
<title>From</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="JavaScript">
function Go(aString)
{
var vMapWindow = window.open("To.html", "CurrentMap");
vMapWindow.focus();
vMapWindow.Go(aString);
return false;
}
</script>
</head>
<body >
<a href="T1" id="T1" onclick="return window.Go(id)"> <p>T1
anchor</p></a>
<a href="T2" id="T2" onclick="return window.Go(id)"> <p>T2
anchor</p></a>
</body>
</html>
When I press either the "T1" or "T2" links on the "From.html" page,
what is supposed to happen is that the browser is supposed to open a
new window showing "To.html" (which it does), give it the focus (which
it does even without the focus() call, but as I understand it browsers
are not consistent here), and then call the Go() method in the new
window showing "To.html" which should bring up the alert. It doesn't
do this however. In fact, it seems to throw an exception instead,
causing the "From.html" window to attempt to navigate to the
non-existent "T1" or "T2" page.
I am testing this with Safari, but have also tried Firefox and even
old Mac IE 5, and all of them fail the same way so I assume this is
not a browser problem, but a mistake on my part. Anybody know what my
mistake is?