OnChange is not working
I have this problem:
I need to check progamatically a Checkbox named 'comp' only when an input text field named 'cant' receives something.
Here is my code, it is not working at all.
$stream .= "<td><input type='text' name='cant' id='cant' size='5' onChange='document.form1.comp.checked=true' /></td>";
$stream .= "<td><input type='checkbox' name='comp' value=$i /></td>";
this code is within a form named 'form1'
Any help is welcome.
Thanks in advance.
Your code actually works, but I'm assuming not like you want it to. For text inputs, the onchange event fires after the text box loses focus. If you are wanting to check the 'comp' box as keys are being pressed you may want to use onkeypress, onkeyup or onkeydown.
Also, assuming you only want this box checked if there is actually text in your text box you may want to set up a function instead that checks the value of your 'cant' text box first before checking (or unchecking) the checkbox.
My code is not working, I am working on Firefox and Linux Ubuntu, I don't know if there is some kind of problem with this environment but is not working.
Can you see some error in my code???
Let me tell you that this code is inside a Perl script.
If for some reason you are still having trouble (after typing in the box and then clicking somewhere else on the page) then there would likely have to be an error or issue with your Perl script outputting the code. In Firefox you can use the Error Console to view any possible issues that are giving you problems.
Try Using IE(internet explorer)
On the Advance option you have to disable the debugging
then u might will see the error
Reagrding the script question I have no clue wut you want ???
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)