dynamic display

R

raj

hi
My html is:


<Table style="year-button-archive" width="60%" >
<tr>
<td class="gold" >
<a title="year">By Year:</a>
<td class="gold">
<a id = "2008" title="2008" href="../
announcementList.do?year=2008">
2008
</a>&nbsp; | &nbsp;</td>
<td class="gold">
<a id = "2007" title="2007" href="../
announcementList.do?year=2007">2007 </a>&nbsp; | &nbsp;
</td>
<td class="gold">
<a id = "2006" title="2006" href="../
announcementList.do?year=2006">2006</a>&nbsp; | &nbsp;
</td>
<td class="gold">
<a id = "2005"title="2005" href="../
announcementList.do?year=2005">2005 </a>&nbsp; | &nbsp;
</td >
<td class="gold">
<a id = "all" title="All" href="../
announcementList.do?year=all">All </a>
</td>
</tr>
</Table>

my css



1. .gold {
2. color: #877514;
3. }
4. .gold A:link {COLOR: #877514; TEXT-DECORATION: none }
5. .gold A:visited {COLOR: #877514; TEXT-DECORATION: none }
6. .gold A:hover {COLOR:red; TEXT-DECORATION: underline; }
7. .gold A:active {COLOR: #877514; TEXT-DECORATION: none }
8.



on clicking the year i need to change the colour to red and should be
in red till i click another year.so i had written js

function showYear(){
alert(<%= request.getParameter("year") %>);
var sYear = <%= request.getParameter("year") %>;
alert("sYear" +sYear);
if(sYear != null){
alert(sYear);
document.getElementById(sYear).style.color = "red";
}
}


it works fine for the years 2008,7,6,5 ..in my first alert stmt
i get 2008,7,6,5 correctly from the request but when i click on all i
am not getting all from the request its taking full URL.
like http://localhost:8080/sgxt/announcementList.do?year=all
it should take
all alone.
what may be the cause of this behavior when its working for other
years

Thanks in advance
Raj
 
D

David Mark

hi
My html is:

Awful. Sorry, it has to be said.
<Table style="year-button-archive" width="60%" >
                <tr>
                    <td class="gold" >
                        <a title="year">By Year:</a>
                    <td class="gold">
                        <a id = "2008" title="2008" href="../
announcementList.do?year=2008">
                        2008
                        </a>&nbsp; | &nbsp;</td>
                    <td class="gold">
                        <a id = "2007" title="2007" href="../
announcementList.do?year=2007">2007 </a>&nbsp; | &nbsp;
                    </td>
                    <td class="gold">
                        <a id = "2006" title="2006" href="../
announcementList.do?year=2006">2006</a>&nbsp; | &nbsp;
                    </td>
                    <td class="gold">
                        <a id = "2005"title="2005"  href="../
announcementList.do?year=2005">2005 </a>&nbsp; | &nbsp;
                    </td >
                    <td class="gold">
                        <a id = "all" title="All" href="../
announcementList.do?year=all">All </a>
                    </td>
                    </tr>
            </Table>

my css

   1. .gold {
   2.     color: #877514;
   3. }
   4.     .gold A:link {COLOR: #877514;    TEXT-DECORATION: none }
   5.     .gold A:visited {COLOR: #877514; TEXT-DECORATION: none }
   6.     .gold A:hover {COLOR:red;    TEXT-DECORATION: underline; }
   7.     .gold A:active {COLOR: #877514;    TEXT-DECORATION:none }
   8.

What if you want to go with a silver theme in the future? And how
will a color-blind person see your links? Are they to hover over
every word on the page looking for underlines?
on clicking the year i need to change the colour to red and should be
in red till i click another year.so i had written js

Okay. It's your page.
function showYear(){
        alert(<%= request.getParameter("year") %>);

Don't post server side code here.
        var sYear = <%= request.getParameter("year") %>;
        alert("sYear" +sYear);
        if(sYear != null){
        alert(sYear);
        document.getElementById(sYear).style.color = "red";
        }

}

Too much, too soon. Learn HTML and CSS first.
it works fine for the years 2008,7,6,5 ..in my first alert stmt
i get 2008,7,6,5 correctly from the request but when i click on all i
am not getting all from the request its taking full URL.
like  http://localhost:8080/sgxt/announcementList.do?year=all
it should take
all alone.
what may be the cause of this behavior when its working for other
years

Rule #1. Start with valid markup. Then when something goes wrong,
you have one less variable to consider. And what a variable it is.
There are no standard specifications for HTML error correction.

Rule #2. Use a proper doctype so that browsers don't downshift into
quirks mode. Quirks mode is there to deal with invalid and/or
deprecated markup. If you followed the first rule, then you don't
have any.

Yes, it seems 99% of today's Websites break one or the other of these
rules. That's why scripts fail constantly on the Internet (and
seemingly never get fixed.) Follow the rules and you are way ahead of
the game.

So now debug the script. If you can't, post it without the server
side includes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,138
Messages
2,570,802
Members
47,348
Latest member
nethues

Latest Threads

Top