Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Click checkbox to highlight row doesn't work
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

ngaisteve1
Junior Member

Malaysia
241 Posts

Posted - 11 September 2003 :  04:22:45  Show Profile  Send ngaisteve1 an ICQ Message
<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  Show Profile
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
Go to Top of Page

ngaisteve1
Junior Member

Malaysia
241 Posts

Posted - 11 September 2003 :  05:20:28  Show Profile  Send ngaisteve1 an ICQ Message
Still can't.
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 11 September 2003 :  06:06:07  Show Profile
Perhaps this might help: http://p2p.wrox.com/archive/asp_databases/2002-04/83.asp I tried that one, and it didn't work for me. The codes given on the following page do work: http://forums.devshed.com/t33094/s.html

Edited by - Roland on 11 September 2003 06:17:42
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.28 seconds. Powered By: Snitz Forums 2000 Version 3.4.07