How do i add an image to this button?
<li><input type="submit" value="[var.lang_login]" class="button-form" /></li>
You can use this:
<input <font color='"#FF0000"'>type="image"</font> src="img.png" alt="Submit" name="submit" value="Submit">
Thanks for that. It was really helpful.
I have another question, please.
When I try to add an image to this:
<input type="button" name="search" value="Purchase Credits" onclick="window.location.href='credits.php';">
<input type="image" src="img.png" name="search" value="Purchase Credits" onclick="window.location.href='credits.php';">
I now see the image button, but when I click it, I don't get taken to the correct page now.
where did you want the button to take you to? you have added a .js that sends a user to "credits.php", in your OP this button would have simply submitted the form. if that's what you want then just remove the onclick .js
Thanks for your reply.
I'm not clear on what you're saying, but this is an open source script that's modified.
I didn't add .js, it came that way.
It works correctly without the image (including the .js and onclick and credits.php).
I'd like it to continue to work the same way, but I'd just like to add an improved image, to the button. Which I did but it somehow screws up the button's original execution, which is to take me to credits.php.
Any other help will be appreciated.
Sorry, I see how my phrasing was all worbly there.
you need to counter the default action of the image input ( which is to submit the form) to do this you add 'return false; ' as the last thing in your onclick e
<input type="image" name="search" src='image.jpg' value="Purchase Credits" onclick=" window.location.href='credits.php'; return false;">
note that this is specific for using INPUT type='image' , you could have just used BUTTON or even IMG with your original onclick code.
This topic is now closed. New replies are no longer allowed.