Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 29th, 2005, 08:27 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default change style.backgroundColor the reset all others

Code:
function colour(el_id)
{
    //alert("FUNCTION: colour");
    var el = document.getElementById(el_id);    
    el.style.backgroundColor = "#E2E6ED";

}

<td id="ADTcell:<%=x%>">
    <%
    'response.Write "x = " & x & "<br>"
    'response.Write "noc = " & noc & "<br>"
    if CInt(x) <= CInt(noa) then
    'response.Write "<h4>linie 724</h4>"
    %>    
    <input type="radio" name="pass" id="adt<%=x%>" onMouseOver="style.cursor='hand'" onClick="return colour('ADTcell:<%'=x%>');" />
    <%
    else
    response.Write "&nbsp;"
    end if
    %>
    </td>
Is there a way i can have only one cell highlighted at any one time? So that when one cell is changed to #E2E6ED then all other cells are changed to #FFFFFF?

TIA.

Picco


www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old September 29th, 2005, 08:58 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Yes, onmouseover assign a background colour to the table as a whole, or if you prefer loop through the table.rows and assign a background colour to each row. Then assign the target cell its own colour. When onmouseout fires set the whole table back to its original colour.

--

Joe
 
Old September 29th, 2005, 09:52 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

Code:
    <table border="1" bordercolor="#000000" id="passSel">
    <tr class="mainFnt">
    <td>&nbsp;</td>
    <td>Adult</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>    
    </tr>
    <% for x = 1 to noa %>
    <tr class="mainFnt">
    <td id="ADTcell:<%=x%>">
    <%
    'response.Write "x = " & x & "<br>"
    'response.Write "noc = " & noc & "<br>"
    if CInt(x) <= CInt(noa) then
    'response.Write "<h4>linie 724</h4>"
    %>    
    <input type="radio" name="pass" id="adt<%=x%>" onMouseOver="style.cursor='hand'" onClick="document.form.activePass.value=this.id;" />
    <%
    else
    response.Write "&nbsp;"
    end if
    %>
    </td>
    <td><%=x%></td>
    <td id="adtfname<%=x%>">adtfname</td>
    <td id="adtlname<%=x%>">adtlname</td>
    </tr>
    <% next %>


    <tr>
    <td colSpan="<%=cols%>" align="center">        
    <input type="button" name="Submit" value="Hold Seat" onclick="javascript: chkFrm('<%=seg%>');"
    STYLE="font-weight : bold; color: #064a6d; font-size : 10; text-align : center;" />    
    </td>
    </tr>    
    </table>
how do i build that into my function? that is my table.

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt





Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic change of style rajesh_css Javascript 3 October 10th, 2008 04:45 AM
Change Drop down Border style ismailc XSLT 2 December 10th, 2007 07:25 AM
Change C# application Visual Style niting85 .NET Framework 2.0 0 April 30th, 2007 03:27 AM
!resolved! - a change in coding style grimmy PHP How-To 1 June 27th, 2004 10:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.