Author |
Topic |
|
ngaisteve1
Junior Member
Malaysia
241 Posts |
Posted - 11 September 2003 : 04:22:45
|
<script language = "Javascript"> <!-- var IE = (document.all) ? true : false; var DOM = (document.getElementById) ? true : false; var NS4 = (document.layers) ? true : false;
function action(elm,colOn,colOff){
if (elm.checked) { colorRow(elm.value,colOn,'white'); // use white as highlighted foreground color text } else { colorRow(elm.value,colOff,'black'); // use black as default foreground color for text } }
function colorRow(which,Bcolr,Fcolr){ var whichRow = (IE) ? document.all[which] : (DOM) ? document.getElementById(which) : false;
if (whichRow) { if (IE){ for (var i=0;i<whichRow.children.length;i++){ whichRow.children[i].style.backgroundColor=Bcolr; whichRow.children[i].style.color = Fcolr; } } else if (DOM){ for (var i=0;i<whichRow.cells.length;i++){ whichRow.cells[i].style.backgroundColor=Bcolr; whichRow.cells[i].style.color = Fcolr; } }
}
}
//--> </javascript>
<form action=email_delete.asp method=post onSubmit="return ValidateForm(this,'list')"> <tr> <td colspan=2> <table border=1 cellspacing=0 cellpadding=2> <tr valign="middle" bgcolor="#666666" style="color:#FFFFFF"> <td nowrap>Header</td> <td nowrap>Date</td> <td><input type=submit value=' X '></td> </tr> <% Do While Not rs.EOF response.Write "<tr valign=top id=" & rs("email_id") & "><td nowrap><A onclick=" & Chr(34) & "NewWindow(this.href,'name','440','200','yes');return false" & Chr(34) & " class=" & Chr(34) & "content" & Chr(34) & " HREF='email_view_form.asp?passkeyword=" & rs("email_id") & "'>" & rs("email_header") & "</a></td>" response.write "<td nowrap>" & rs("email_date") & "</td>" response.write "<td><input type='checkbox' name=" & rs("email_id") & " value=" & rs("email_id") & " onclick='action(this,'red','white')'></td></tr>" rs.MoveNext Loop%> </table> </td> </tr> <tr><td colspan=2><a href=email_add_form.asp class=content>Send E-Mail</a></td></tr> </form>
When I click the checkbox, that row, should be highlighted, but it doesn't and I wonder what is the problem. Thanks for any help. |
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 11 September 2003 : 05:01:25
|
check your code... onclick='action(this,'red','white')' will not work I don't think, should be onclick="action(this,'red','white')" or if the above statement is in a response.write it will be onclick=""action(this,'red','white')""
You don't need that chr(34) stuff, it makes the code confusing, use double double quotes as above |
The UK MkIVs Forum |
|
|
ngaisteve1
Junior Member
Malaysia
241 Posts |
Posted - 11 September 2003 : 05:20:28
|
Still can't. |
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
|
|
Topic |
|
|
|