Click to See Complete Forum and Search --> : onKeypress masked for html, not working


wene
10-11-2004, 04:00 AM
Hi Devies,

please have a look at the code:

it's part of a date picker, which also displays an input field for entering the time, i want to prevent an action if Enter is clicked within the input field...


(...)
str_buffer +=
"<form name=\"cal\">\n<tr><td colspan=\"7\" bgcolor=\"#95ABA1\">"+
"<center><font color=\"White\" face=\"arial, verdana\" size=\"2\">"+
"Time: <input type=\"text\" name=\"time\" value=\""+dt2tmstr(dt_datetime)+
"\" size=\"8\" maxlength=\"8\" onKeypress=\"return noenter();\"></font></center></td></tr>\n</form>\n" +
"</table>\n" +
"</tr>\n</td>\n</table>\n" +
"</body>\n" +
"</html>\n";

(...)
function noenter() {
return !(window.event && window.event.keyCode == 13);
}

it is not working, WHY???