...

View Full Version : Syntax problems with breaking up html statement in javascript



kobyskid
01-28-2009, 02:33 PM
I can't seem to get an image to appear and I know it is because I can't break up this statement right the images are saved as ad1, ad2 etc. and it is supposed to come up with a random image managed to get it to work last night but then I left my memory stick and it is due today. Basically I can't get the quotation marks right.



document.write('<a href="rLink"><img source= "ad'+rNumber+'.js" alt="rAd"/></a>')


Thanks.

Philip M
01-28-2009, 02:44 PM
document.write('<a href="rLink"><img src= ad" + rNumber + ".js" alt="rAd"/></a>')

kobyskid
01-28-2009, 02:50 PM
ya that didn't work

angst
01-28-2009, 03:16 PM
ya that didn't work

well his code is correct, so maybe thats not the issue, can you post more of your script?

Philip M
01-28-2009, 05:04 PM
ya that didn't work

"How sharper than a serpent's tooth it is to have a thankless child! Away, away!" Shakespeare's 'King Lear', 1605

flynch01
01-28-2009, 05:23 PM
document.write('<a href="rLink"><img src= "ad'+rNumber+'.js" alt="rAd"/></a>')

Should be src. That's the only error I can see. The reason Philips doesn't work is because it seems he didn't notice you're using single quotes and is using " to + the statements together. Your example was right in the first place. Just the source part needed changing.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum