<script>
function aclick()
{
var xy;
var xy = 0;
if (xy === 0) {
document.getElementById('abc')
.src="D:\\FLoW Dumbian\\pics\\healer.png";
var xy;
var xy = 1;
}
else if (xy === 1) {
document.getElementById('abc')
.src="D:\\FLoW Dumbian\\pics\\electrician.png";
var xy;
var xy = 0;
}
}
</script>
Seems the headline got chopped off, so could describe the problem again?
Hey, so i want to change image whenever i press a button
xy = 0 -> if = true and the image changes, at the end it sets xy = 1 and the next time i click the button if = false cause xy is 1 not 0 and skips to else vica verse
You logic is off. xy will be 0 every time the button is clicked since you set it to 0 in the beginning of the function.
Then maybe you shouldn't use Windows paths and they shouldn't contain spaces.
That xy thing can be avoided. Look up getAttribute().
An example...
You're right. I feel so dumb. Thank you for clarifying it for me. jesus
//edit: I'm not using any tutorials and i'm learning html for three days. I don't know lots of stuff yet, thanks for your help.
Then you've come a long way. I didn't even dare to look at JavaScript until the fourth day.
What can i say, i'm a quick study but my goal is to make a game and this is for my character selection :'D. Anyway, have a nice day and thank u a lot!!
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)