Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit Button Image

Status
Not open for further replies.

DigitalBoy

Programmer
Oct 11, 2000
87
US
I know this has been asked at least a hundred times before, but I haven't found the post. I want to replace my submit button with an image WITH an onClick function built in. What is the code that I need to do this? Thanks for your patience.

- DB

dgtlby@excite.com
Administrator

UBB Developers Network

 
One quick addition. I'm developing for an interactive TV platform. Without going into much detail, I know that I MUST have the link act like an <a> tag. However, when I wrap the above code in an <a href=&quot;#&quot;></a> tag set, NS (the browser I'm testing in,) just sits there. WITHOUT USING CSS(because the browser I'm developing for doesn't support it,) is there a way to get the hand to appear?

- DB dgtlby@excite.com
Administrator

UBB Developers Network

 
Ok, I thought I had it working. Here's the current status.

1) A cookie is written via the following button:

<input type=&quot;submit&quot; name=&quot;createCookie&quot; value=&quot;Create Cookie&quot; onClick=&quot;setCookie('ratingsGroup',findChecked(),exp)&quot;>

When the form is &quot;submitted&quot; a new page is loaded where the cookie is read into memory and written to the screen. OK, not a problem. The issue arrises when I try and do the same exact thing with the following &quot;button&quot;:

<input type=&quot;image&quot; src=&quot;images/button_check.gif&quot;; onClick=&quot;setCookie('ratingsGroup',findChecked(),exp)&quot;>

The cookie isn't written, but the page that is called but not updated. How do I get this image button to act exactly like its form counterpart?

- DB

dgtlby@excite.com
Administrator

UBB Developers Network

 
I just realized that the above does NOT work with NS, which is the closest compatable browser that I have to develop for (currently developing for interactive TV.) Any suggestions on how to make this work for NS?

- DB

dgtlby@excite.com
Administrator

UBB Developers Network

 
As far as working goes - the only difference between them (for I.E. atleast) is that the image button is not performing any submission - the submit button is.

So you need to add some call to document.formName.submit() in there to make them equivalent. It's hard to tell without knowing what your action holds - but that is only difference I can see.

Get it working with an ordinary button first - then see if it's some quirk with the type=&quot;image&quot;. Also you could forget about the form element - and just use the image as a link to call the function.
b2 - benbiddington@surf4nix.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top