PDA

View Full Version : Loading frames and Javascript together


ringo
01-14-2005, 03:44 AM
<HTML>
<HEAD>
<SCRIPT>
function closeIt()
{
event.returnValue = "Testing";
}
</SCRIPT>

<FRAMESET ROWS="50%,50%">
<FRAME NAME="One" SRC="one.php">
<FRAME NAME="Two" SRC="two.php">
</FRAMESET>
</HEAD>

<BODY onbeforeunload="closeIt()">
</BODY>
</HTML>

If I put the codes as above, the function onbeforeunload="closeIt()" does not work at all but I can managed to see the frames. If I put the function onbeforeunload="closeIt()" before the frameset, I cannot view the frames at all and javascript function is working. How can I solve this so that I can view the frames and want the javascript function to work as well?

_Aerospace_Eng_
01-14-2005, 04:01 AM
thats not even a valid frameset, however, the frameset will override the body tags because those truly should be seen by a user who has noframes, hence making your script nonfunctional, y dont u just put it on one of your frameset pages?

sage45
01-14-2005, 06:43 PM
<HTML>
<HEAD>
<SCRIPT>
function closeIt()
{
event.returnValue = "Testing";
}
closeIt();
</SCRIPT>

<FRAMESET ROWS="50%,50%">
<FRAME NAME="One" SRC="one.php">
<FRAME NAME="Two" SRC="two.php">
</FRAMESET>
</HEAD>

<BODY>
</BODY>
</HTML>

Could try this way...

-sage-