...

View Full Version : Can Someone tell me what is wrong with this code?



KimHuff
03-17-2005, 10:12 AM
I have the following body tag on one of my websites. Everything has worked fine until I had to add the toggle command for some blinking text I needed on the page. (And before anyone says it.. Yes, I too hate blinking text... but I have having a terrible time getting people to read stuff.. and I am grasping at straws)

Anyway, I am sure it has something to do with the way I have the toggle command in the onLoad section. I just dont know how to tie the various onLoad commands together.


<body bgcolor="#FFFFFF" text="#000000" link="#26265F" vlink="#26265F" alink="#26265F" leftmargin="0" topmargin="0" rightmargin="0" marginwidth="0" marginheight="0"
onLoad="toggle(); MM_preloadImages('images/homeOVER.gif','images/guestsOVER.gif','images/committeesOVER.gif', 'images/hotelOVER.gif','images/propsOVER.gif', 'images/photosOVER.gif','images/aboutOVER.gif','images/registerOVER.gif', 'images/dealersOVER.gif','images/charitiesOVER.gif','images/policiesOVER.gif',)">

Thanks,

Kim

ronaldb66
03-17-2005, 12:31 PM
To combine multiple function calls in the unLoad event handler is decribed here (http://javascriptkit.com/javatutors/multiplejava3.shtml).
Since this is more of a JavaScript issue, i'll request a moderator to move the thread; please do not cross-post (http://www.codingforums.com/postguide.htm).

Kurashu
03-17-2005, 12:55 PM
On another note, you might want to move the styling into a CSS file, or at least into a style attribute.

KimHuff
03-17-2005, 01:05 PM
Thanks Ronald. I should have posted it there, but it was late and I was tired. If someone can move it.. that would be great.

In the mean time... I went to that link you provided and unfortuantely, that didnt help.

The JavaScript works if ONLY the onLoad="toggle();" is listed. Once I add the MM_preloadImages 'images/homeOVER.gif', 'images/guestsOVER.gif', 'images/committeesOVER.gif', 'images/hotelOVER.gif', 'images/propsOVER.gif', 'images/photosOVER.gif', 'images/aboutOVER.gif', 'images/registerOVER.gif', 'images/dealersOVER.gif', 'images/charitiesOVER.gif', 'images/policiesOVER.gif',)" to the end of the statement.. making sure to delete the last set of quotes from the above toggle statement, it still doesnt make the text blink. If I remove all of the preloaded images script, the text will blink.

If a moderator can move this to the appropriate place, I would appreciate it.

Kim

_Aerospace_Eng_
03-17-2005, 01:11 PM
we need the rest of your code, there is the possibility of another window.onload in the head part of your document

KimHuff
03-17-2005, 01:27 PM
I guess the easiest way to see the entire code is to check out the site.

http://www.starbaseindy.com

The code I am talking about is on the main index.html page.

Thanks again everyone,

Kim

_Aerospace_Eng_
03-17-2005, 01:40 PM
one solution could be to take out the toggle(); from the onload in the body tag, and add this in between any of your script tags

setTimeout("toggle()",0);

KimHuff
03-17-2005, 01:52 PM
Aerospace,

Well, I am not sure if I understood exactly where you were talking about, but I deleted the toggle from the body onLoad and then moved the new option into the <script> tag for the blink javascript. Unfortunately, it is still not blinking.

I HATE blink commands, but I feel like I have no other choice. Last year's convention had all the info on the site, but people just wouldnt read the site. Hopefully, with the blinking text on the main page, people will click there and read the answers to some of the most commonly asked questions.

Thanks,

Kim

_Aerospace_Eng_
03-17-2005, 01:53 PM
okay you put it in the wrong place, i said the script tags not in the function try this

<script type="text/javascript"><!--

var time_displayed=1500; // How long do you want to show the image for before it is hidden again.
var time_hidden=500; // How long do you want to hide the image for before it is shown again.

var n=0
var proceed="no"

function blink(){

n=(n==1)?0:1;

if(proceed=="yes"){
document.getElementById("blinking").style.visibility=(n==1)?"hidden":"visible";

if(n==1){setTimeout("blink()", time_hidden);}
else{setTimeout("blink()", time_displayed);}

}

else{document.getElementById("blinking").style.visibility="visible";}

}


function toggle(){

proceed=(proceed=="yes")?"no":"yes";

blink();

}
setTimeout("toggle()",0);
//--></script>

KimHuff
03-17-2005, 01:54 PM
It should be there now. I uploaded it already.

Kim

_Aerospace_Eng_
03-17-2005, 01:56 PM
revised the post above^^ and on a site note u could accomplish the same thing with an animated blinking image, so IF javascript is turned off it would still work

KimHuff
03-17-2005, 01:59 PM
ARGH!!! Could it be my browser? I am using the latest and greatest of IE.

Kim

KimHuff
03-18-2005, 06:22 AM
Does anyone have a suggestion as to why this isnt working??

Kim

_Aerospace_Eng_
03-18-2005, 09:20 PM
okay didn't catch it before, u had an extra comma in your previous onload, try this, and take out the setTimeout("toggle()",0); that i told you to put in earlier

onLoad="toggle();MM_preloadImages('images/homeOVER.gif','images/guestsOVER.gif','images/committeesOVER.gif','images/hotelOVER.gif','images/propsOVER.gif','images/photosOVER.gif','images/aboutOVER.gif','images/registerOVER.gif','images/dealersOVER.gif','images/charitiesOVER.gif','images/policiesOVER.gif')"

KimHuff
03-19-2005, 04:50 AM
Thanks areospace.. that fixed it

Kim



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum