Click to See Complete Forum and Search --> : javascript controled frame?
Justin
06-30-2003, 08:21 AM
i want a script that will tell the brouser to go to fireworks.html in the disp frame on the 4th of july for a fireworks display on that day.
how would you do that
<frameset cols="20%, *" border="0" frameborder="NO">
<frame src = "mainnav.html" name = "nav">
<frame src = "mainhome.html" name = "disp">
</frameset>
</html>
Khalid Ali
06-30-2003, 09:31 AM
what you can do is write a little code snippet that validates the current date every time page is loaded,and if the date is July 4 then redirect to the page you have fire works on.
There must be some code like this on the web..do a google search.
khaki
06-30-2003, 10:04 AM
hi Justin...
i really do hate answering questions from the javascript forum...
but...
if this is wrong... you'll get a correction from somebody pretty soon (the people here tend to mop-up my javascript messes for me :rolleyes: )...
but i'm pretty sure that this works:
(try it... what do you have to lose :) ) :
;) k
(this would be the page titled "mainhome.html")
<html>
<head>
<title>mainhome</title>
<script language="JavaScript">
function independenceDay()
{
now = new Date();
if (now.getMonth()+1 == 7 && now.getDate() == 4)
{
location.href=('http://www.4th_of_July_page.html')
}
}
</script>
</head>
<body onload="independenceDay()">
Not July 4th Contents
</body>
</html>
Khalid Ali
06-30-2003, 10:10 AM
The only thing that "may" need to be changed is this line
<script language="JavaScript">
it could be
<script type="text/javascript">
Rest of the code is exactly What I mentioned above..
pretty fast K..