Hello people,

I want that when I mouse over a checkbox, that it is checked.

I have now the following code:

<script language=javascript>
function checkit(myform, name)
var xx = document.myform.name;
xx.checked = true;

<form name=myform27>
<input type=checkbox name=mycheck onMouseOver="checkit(myform27,mycheck)" value="1"> Checking

But this does not work, it says "document.myform is undefined".

How to solve this, and what are i am doing wrong?

How about this:

<script type="text/javascript">
function checkit(formName, checkBox) {
var xx = document.formName.elements.checkBox;
xx.checked = 1;

<form name="myform">
  <input type="checkbox" name="mycheck" onMouseOver="checkit('myform','mycheck')" value="1"> Checking</input>

Or you can just simplify things by doing this:

<form name="myform27" action="#" onsubmit="return false;">
<label for="chk1">
<input type="checkbox" name"myCheck" id="chk1" onmouseover="if (!this.checked) { this.checked = true; } else { this.checked = false; }" />Checkbox</label>
Solved my problem correctly
This question has already been answered. Start a new discussion instead.