Forum Moderators: phranque

Message Too Old, No Replies

Correct synthax for input type

         

specter

8:54 pm on Jun 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi guys,

Here is the problem:

I have to execute a script subroutine by means of a button;
The sub is called "send":
How would the correct synthax be?

<Input type= button value=send>

or what else?

Thanks for any helpful hint

sincerely

kaled

9:53 pm on Jun 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<input type="button" value="Send" onclick="send()">

I'm half asleep but I think that should do it.

Kaled.

rocknbil

10:46 pm on Jun 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Better yet, if Javascript is disabled, button won't do . . . . anything. Use submit, and add return false to the form tag:

<form action="wherever.cgi" onSubmit="return false;">
<input type="submit" onClick="send(this.form);" value="Send">
</form>

<script type="text/javascript">
function send() {
alert('Javascript is enabled');
form.submit();
}
</script>