...

View Full Version : checkbox with innerHTML



Oompi
07-07-2004, 04:03 PM
Hi!

I made this script but always that submit is done all checkbox in the page are erased. My question is, how make submit, without that checkbox are erased from the page ?

JS script:
----------

<script language="JavaScript" type="text/javascript">
<!--
function checkForm()
{
if (document.addcheck.info.value == "") {
document.addcheck.info.focus();
return false;
} else {
elem = document.getElementById('checkID');
elem.innerHTML = elem.innerHTML + "<input type='checkbox' name'check[]' value='+ document.addcheck.info.value +'>" + document.addcheck.info.value + "<br>";
return true;
}
}
//-->
</script>

PHP file:
----------

...

<?
echo "
<form method=\"post\" action=\"addcheck.php\" name=\"addcheck\">
<input type=\"text\" name=\"info\">
<input type=\"submit\" name=\"anexar\" value=\"Anexar\" onClick=\"checkForm();\"><br><br>
<div id=\"checkID\"></div>
</form>";
?>

...

Tks for the help!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum