Custom Check field

admin

Administrator
Staff member
Hi, I'm trying to make a custom check field. Currently its like this.

<script language="javascript">
function toggle(object) {
var newvalue = (object.innerText=='') ? 'true' : 'false';
object.innerText=(object.innerText=='') ? 'V' : '';
eval("document.form."+object.input+".value='"+newvalue+"'");
}
function check(name, value) {
if (value==true) {
document.write("<div input='"+name+"' class='check' onclick='toggle(this);'>V</div>");
document.write("<input name='"+name+"' type='hidden' value='http://www.webdeveloper.com/forum/archive/index.php/true'>");
}
else {
document.write("<div input='"+name+"' class='check' onclick='toggle(this);'></div>");
document.write("<input name='"+name+"' type='hidden' value='http://www.webdeveloper.com/forum/archive/index.php/false'>");
}
}
</script>

<form method="post" action="current_game" name="form">
<script language="javascript">check("field1", false);</script>
<script language="javascript">check("filed2", false);</script>
</form>


Uhm doest work 100%
I would like to have the toggle function lill improved.
Like toggle(this.form) or something so I can use he function for multiple forms
 
Back
Top