Forum Moderators: open

Message Too Old, No Replies

arday javascript + css application

How can I apply a css class to a link that uses the ardy javascript?

         

jetnovo

2:03 am on Mar 6, 2004 (gmt 0)

10+ Year Member



Here's my source code for a line of text navigation in a site I'm building for an access radio station:

-----------------------------------------

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

today = new Date();
day = today.getDay();

arday = new Array("<a href=..schedule/sunday.htm>", "<a href=..schedule/monday.htm>", "<a href=..schedule/tuesday.htm>", "<a href=..schedule/wednesday.htm>", "<a href=..schedule/thursday.htm>", "<a href=..schedule/friday.htm>", "<a href=..schedule/saturday.htm>");

document.write(arday[day] + "today's shows" + "</a>");
// End -->

</script>

¦ <a href="../schedule/index.htm" class="nav">weekly&nbsp;schedule</a>

¦ <a href="../whatson/index.htm" class="nav">what's&nbsp;on&nbsp;guide</a>

¦ <a href="../freshflash/index.htm" class="nav">fresh&nbsp;flash</a>

¦ <a href="../contactus.htm" class="nav">contact&nbsp;us</a>

-----------------------------------------

The arday javascript works fine insofar as that it correctly links to a different page for each day of the week ("../schedule/monday.htm" on Monday, for example). BUT, I've used the class "nav" to define the formatting properties of all links in this bit of code.

The class applies itself correctly to all links except the arday javascript defined "today's shows", which retains the default link formatting used elsewhere in my site.

How can I apply the class "nav" to the javascript-defined link?

jetnovo

2:23 am on Mar 6, 2004 (gmt 0)

10+ Year Member



20 minutes later and I've just found a solution, by using css descendant selectors for my a:link and a:visited and a:hover attributes.

If you're interested here's where I found the information:

[westciv.com...]