Click to See Complete Forum and Search --> : Simple Problem


saddysans
December 10th, 2002, 07:05 AM
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



<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

Brane
December 11th, 2002, 09:11 AM
try

alert("Hello")

without ";"

Albatross
December 14th, 2002, 09:03 AM
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.

vickers_bits
December 15th, 2002, 06:30 AM
you could try putting the alert within mainframe.htm

JTHoward
December 17th, 2002, 02:56 PM
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