-
Simple Problem
Hello Friends.
Can anybody tell me whats wrong in this code, its giving runtime error whenever i click the mainframe, rather than alert. Both mainFrame.htm and topmenu.htm are empty files
Code:
<html>
<head>
<title>
Testing Co-Browsing
</title>
<script language="javascript">
function ButtonClick()
{
alert("Hello");
}
</script>
</head>
<frameset rows="15%,85%">
<frame src="topmenu.htm" name="topmenu">
<frame src="mainframe.htm" name="mainwindow" onClick="ButtonClick()">
</frameset>
</html>
thanx
saddysan
-
try
alert("Hello")
without ";"
-
I tried out your code and with Netscape 7.0 it worked. It complained that it could not find topmenu.htm and mainframe.htm and filled both areas with white space but the click over mainframe.htm still activated the alert().
And the ";" at the end was unimportant, with or without netscape likes it.
However with IE 6.0 it complained about not finding the two pages and filled both areas with standard "not found" pages. And the click over the lower frame did not work.
Frames were originally introduced by Netscape and IE caught up with them in version 3. But many other browsers don't implement them at all I've heard.
It's a browser to browser question.
-
you could try putting the alert within mainframe.htm
-
The frameset is simply a double browser display. It's not going to be aware of events in the same way as a regular browser display.
What vickers_bits suggested is correct. In otherwords, the click event is taking place within "mainframe.htm" not the frameset.
Simply move your script function to mainframe.htm and motify your body tag in mainframe.htm according the example below, and all should work fine.
<body onclick="ButtonClick()">
Hope this helps...
JT