...

View Full Version : What's wrong with this function?



allyson
07-21-2002, 05:26 AM
Hi

I am having difficulty with the displaylogo() function. I have given the logo "name=slide" and had hoped that the displaylogo() would be able to display the content of image1.src. What am I doing wrong? Please help.

<script language="javascript">

<!-- Preload logo
var image1=new Image()
image1.src="images/titlelogo.gif"



function displaylogo() {
setCell('textcell',MO_text['empty']);

document.images.slide.src=eval("image1.src") ;

}

//-->
</script>


<body>

<img src="images/titlelogo.GIF" name="slide" width="220" height="54"




bye
Allyson

ACJavascript
07-21-2002, 07:19 AM
I think this is the mistake -- its not really a mistake just a mis type or somthin. :D:D


document.images.slide.src=eval("image1.src") ;

should be


document.images.slide.src=eval(image1.src) ;


Not garentying that this will work :D, But give it a try :D:D

joh6nn
07-21-2002, 08:02 AM
i'm pretty sure that you don't need to use eval() at all. try this:

document.images.slide.src=image1.src;

allyson
07-21-2002, 08:22 AM
Hi

Thank-you for your suggestions. Unfortunately they do not work. The code is at http://homepages.ihug.co.nz/~usateden/panacea/entryyay.htm

What should happen, is the logo should appear when the mouse is not on the palette. I thought that the document.images.slide.src=image1.src; would work. I'm not sure what's wrong.

bye
Allyson

Pooh
07-21-2002, 09:16 AM
Remove MO_text['empty']='' and put:

MO_text['logo']='<img src="http://homepages.ihug.co.nz/~usateden/panacea/images/titlelogo.GIF" name="slide" width="220" height="54">';


Then for your display logo() function:


function displaylogo() {
setCell('textcell',MO_text['logo']);
}

allyson
07-21-2002, 09:48 AM
Hi

Thank you very much. It works.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum