Why does this not work?

P

Paul

HI! I have a simple form and I use a image for the send button. but I am
trying to remove the "#" which causes the page to jump up before the send. I
use a work around to circumvent this but its causing the script not to
function and I don't know why.

This line below does not work.

<a href="javascript:;"
onclick="document.getElementById('form').submit()"><img src="images/new/send
button.jpg" alt="Send Now" width="54" height="22" border="0"></a>

This code does work.

<a href="javascript:;" class="hintanchor" onmouseover="showhint('Please
enter a valid email address. If you don\'t receive our newsletter then
please check your spam box.', this, event, '150px')">[?]</a>.

Basically a add the "javascript:;" instead of the "#" which causes the jump.

Paul
 
R

Ronx

Does the <form tag contain the attribute id="form" ?
That is similar to <form id="form" method="post" action="whatever">


What happens if your visitor has JavaScript disabled? Pressing Enter
key while a form field is selected will submit the form, but do your
visitors know that? Between 4% and 10% of users have JavaScript
disabled according to some sites, such as http://www.thecounter.com
 
P

Paul

Ronx said:
Does the <form tag contain the attribute id="form" ?
That is similar to <form id="form" method="post" action="whatever">


What happens if your visitor has JavaScript disabled? Pressing Enter
key while a form field is selected will submit the form, but do your
visitors know that? Between 4% and 10% of users have JavaScript
disabled according to some sites, such as http://www.thecounter.com
HI! I have a simple form and I use a image for the send button. but I am
trying to remove the "#" which causes the page to jump up before the
send. I use a work around to circumvent this but its causing the script
not to function and I don't know why.

This line below does not work.

<a href="javascript:;"
onclick="document.getElementById('form').submit()"><img
src="images/new/send button.jpg" alt="Send Now" width="54" height="22"
border="0"></a> This code does work.

<a href="javascript:;" class="hintanchor" onmouseover="showhint('Please
enter a valid email address. If you don\'t receive our newsletter then
please check your spam box.', this, event, '150px')">[?]</a>.

Basically a add the "javascript:;" instead of the "#" which causes the
jump. Paul

HI! Thanks, I will take it under consideration. I am now using a different
approch I got from another user.

<td class="contact_send_button_cell"><p>
<img src='images/new/send button.jpg' alt='Send Now'
style='width:54px;height:22px;cursor:pointer;cursor:hand;'
onclick="document.getElementById('conact_us_email_form').submit();"></p></td>

This works fine and does not make the page jump which is what I was aiming
for.

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top