...

View Full Version : Random number in img tag



Hayes
03-21-2012, 05:12 PM
I need to write something like this: http://justsheri.com/webscripting/wsassignment/1049950/

If you look at the code there is 52 of these <img src = './images/blank1.png'

onClick='clickCard("qh",0)'/> where clickcard("numchanges", increments by 1) how is this done?

Thanks
Danny

Old Pedant
03-21-2012, 08:56 PM
Well, I wouldn't do it the way that was done.

All you really need is <img src="blank.png" id="c1" onclick="card(this);"/>

With "c1" through "c52".

Then you keep the array of card name/images in JS instead of putting the card name into the layout. Makes it easier to code.

But after that... Is this homework? I see that the page you referred us to is, so it makes me think you are doing homewerk as well.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum