chrisjchrisj — 2013-04-20T09:59:19-04:00 — #1
How do i add an image to this button?
<li><input type="submit" value="[var.lang_login]" class="button-form" /></li>
ralphm — 2013-04-20T10:28:00-04:00 — #2
You can use this:
<input <font color='"#FF0000"'>type="image"</font> src="img.png" alt="Submit" name="submit" value="Submit">
chrisjchrisj — 2013-04-20T15:37:01-04:00 — #3
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.
dresden_phoenix — 2013-04-20T16:16:44-04:00 — #4
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
chrisjchrisj — 2013-04-21T16:30:39-04:00 — #5
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.
dresden_phoenix — 2013-04-21T16:59:19-04:00 — #6
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.