Guest richierich1 Posted January 28, 2006 Share Posted January 28, 2006 HiI am trying to run a color change situation of my home page for the user that is rembered on there return which is a problem becuase i have to wrap the opening body tag in script which is ok on its own but i also need to run three images that change every second on the same page which also nees an onload attribute in the opening body tag which works on its own but how can i have both on the same page working. I also keep getting a problem with an object expected by the debugging script in this line.. var p = GetCookie("profile"); Any help will be appreciated college project nearly due... Rich <html><head></head><script language="javascript1.2" src="cookie_functions.js"></script><script language="javascript1.2">var p = GetCookie("profile"); if (p==null){ p = 0; }else{ p = parseInt(p);}var bg, text, bgtop,links, htext;if (p==0){ bg = "#ffffff"; text = "#000000"; bgtop = "#green"; links = "#CC0000"; htext = "#000000";}else if (p==1){ bg = "#FFFFCC"; text = "#0066CC"; bgtop = "#669999"; links = "#000000"; htext = "#FFFFFF";}else if (p==2){ bg = "#669999"; text = "#FFFFFF"; bgtop = "#FFFFCC"; links = "#FFCC99"; htext = "#003399";}else if (p==3){ bg = "#000099"; text = "#FFFFFF"; bgtop = "#FFFFFF"; links = "#CCCCCC"; htext = "#000000";}document.write('<body bgcolor="' + bg + '" text="' + text + '" link="'+links+'" vlink="'+links+'" alink="'+links+'">');</script><table width="608" border="0" align="center"> <tr> <script language="javascript1.2"> document.write('<td height="102" cellspacing="0" cellpadding ="5" valign="middle" bgcolor="'+bgtop+'">'); document.write('<font color="'+htext+'">'); </script> <div align="center"> <p> NATIONAL SCHOOLS BOARD</p> <p>.....</p> </div> <script language="javascript1.2">document.write('<font></td>');</script> <td width="27%" valign="top"><img src="images/CoupleTopImage1.gif" name="image1" width="229" height="96"></td> </tr><tr><td> <p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="scheme.htm">CHANGE COLOUR SCHEME</a></font></p> </td> </body></html> <html><head><script language="javascript1.2">var imagesarray= new Array();var imagename = new Array("../images/CoupleTopImage1.gif","../images/PersonaTopImage2.gif","../images/BusinessTopImage3.gif");var i=0;for (var j=0; j<4; j++){ imagesarray[j] = new Image(); imagesarray[j].src = imagename[j];}function swapimage(){ i = (i+1)%3; document.image1.src = imagesarray[i].src; }function slideShow(){ swapimage();}</script></head><body onLoad="java script:setInterval('slideShow()',1000);"><table width="80%" border="1" align="center"> <tr> <td width="27%" height="100" valign="top"><img src="../images/BusinessTopImage3.gif" width="210" height="97"></td> <td colspan="4" align="center" valign="middle" bgcolor="#009933"><p><font face="Verdana, Arial, Helvetica, sans-serif"><strong>NATIONAL SCHOOLS BOARD</strong></font></p> <p><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><em>the one who cares........ </em></font></strong></p></td> <td width="27%" valign="top"><img src="../images/CoupleTopImage1.gif" name="image1" width="210" height="95"></td></body></html> Link to comment Share on other sites More sharing options...
aspnetguy Posted January 30, 2006 Share Posted January 30, 2006 create a new function that runs on oload. In this new function execute the 2 functions that needed onload. function init(){ slideShow(); otherFunction();}...<body onload="init()">... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now