View Full Version : Random number in img tag

03-21-2012, 06: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?


Old Pedant
03-21-2012, 09: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.