|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
change TD bgcolor
i have a PHP email script, and instead of using PHP to notify of blank entries i want to use JS to do it. i want the TD cell of the blank field to turn red if it is blank. this is what i have so far.
Code:
<script language="JavaScript">
function checkform(sub_form){
if(sub_form.sname.value == ""){
sub_form.sname.focus();
td.className="error";
return (false);
}
</script>
Code:
<form method="post" onSubmit="return checkform(this)"> that is the only thing i can think of to do this. any suggestions? |
|
#2
|
|||
|
|||
|
RE: change TD bgcolor
For things like this I usually read the manuals about javascript.
A long time ago I got the javascript reference and the javascript guide, and they served me very well. Usually if you want to change an item's properties you must give it a unique id and reference it via document.all['id'].property = value. I don't know if you can do this with a TD, but if not you can easily put a div with no paging and margin inside the TD, and I know you can change a div's properties easily. Good luck... |
|
#3
|
|||
|
|||
|
RE: change TD bgcolor
Send to your function the id of the cell (or row) and the elemento to check: with the id you can refer to the cell or the row directly, as you did with the form element
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > change TD bgcolor |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|