Hi I've written a JavaScript function which changes the value of a form textfield when a tickbox is checked/unchecked.
It works fine in Firefox (Mozilla) but doesn't work in Internet Explorer... Why not?
Here's my code:
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script language="JavaScript" type="text/javascript"> function UpdateField() { if (document.form1.field1.checked==true) { document.form1.field.value=1; } else { document.form1.field.value=0; } } </script> </head> <body> <h1>Tickboxes manipulate textboxes</h1> <form id="form1" name="form1" method="post" action=""> <input name="field1" type="checkbox" id="field1" value="1" onchange="UpdateField()" /> <input type="text" name="field" value="0" /> </form> </body> </html>




Bookmarks