...

View Full Version : Please Help using checkbox onclick event



javaspace
02-19-2003, 10:20 PM
HI:

Can someone tell me what's wrong with this simple code.
All I want is to chang the value of the submit button when I click on the check box. I call a function which is changing the submit button value.


Thanks for your help in advance.

<html>
<head>
<title>Tabbed Interface Sample</title>

<script language="javascript">


function addcnt()
{

document.frmedi214d.cmdContinue.value="Hello";
}

</script>
</head>

<body bgColor="lightgrey" );">
<FORM name ='frmedi214d' action='../../nsc1/showformdata.asp' method=post>


<Input type="checkbox" name="accept1" value="1" onFocus="addcnt"> </INPUT>


You have Accepted <INPUT type="button" name="cmdContinue" value="0 Orders" onclick="funSubmit()"> Please Click after viewing all P.O </INPUT>
</FORM>
</BODY>
</HTML>

Owl
02-19-2003, 10:54 PM
Hi javaspace,

... onFocus="addcnt()">

( ) ( )
>>V

glenngv
02-20-2003, 03:52 AM
input tags are self-closing tags, meaning there should be no closing tag

<INPUT type="button" name="cmdContinue" value="0 Orders" onclick="funSubmit()"> Please Click after viewing all P.O </INPUT>

if you want it to be XHTML compatible, you have to use />

<input type="button" name="cmdContinue" value="0 Orders" onclick="funSubmit()" />

and you should use onclick in the checkbox instead of onfocus and simplify it like this:

<input type="checkbox" name="accept1" value="1" onclick="this.form.cmdContinue.value='Hello'">

This will change 0 Orders to Hello. Is this what you really wanted? I suspect what you were trying to change is the text Please Click after viewing all P.O



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum