CSS and Javascript (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


xx75vulcan -> CSS and Javascript (6/5/2006 14:52:52)

Howdy!

I've got a javascript menu that was handed to me. I believe it was hand coded- but not sure.

I need to find a way to specify the font color and size of the menus.

Currently, the menu is embeded into an html page that links a CSS file. The BODY tag in the CSS file will tell the javascript menu what to do, but the problem is, i need the javascript menu to have different font than the rest of the HTML page.

How do I specify a new tag in the CSS file, OR how can i hard code the style in the Javascript menu?

Link to the page containing the menu. If you'd rather I post the whole Javascript I can do that too...

http://www.rockwood.k12.mo.us/default_copy.htm

Much Thanks!




Tailslide -> RE: CSS and Javascript (6/5/2006 15:01:49)

Hi

You seem to have 2 choices. You could either hard code it into the Javascript by finding where it says:

<div style="position:absolute; background:';


and adding in

font-family: Verdana, Arial, sans-serif;


for example, after the "absolute;" bit.

Or you could stick a div around the menu in the code like this:

<div id="mymenu">
<script language="JavaScript1.2" src="nav.js"></script>
</div> <!-- end mymenu -->


and then alter the font in the stylesheet like this:

#mymenu {font-family: Verdana, Arial, sans-serif;}


Obviously using whatever font-family you want! I'd tend to do the second one as it's less likely to go wrong.




xx75vulcan -> RE: CSS and Javascript (6/5/2006 15:12:34)

Wow- that worked fantastic! Much Thanks!

I don't suppose making the drop down menus appear to be slightly transparent would be that easy?




Tailslide -> RE: CSS and Javascript (6/5/2006 15:20:09)

quote:

ORIGINAL: xx75vulcan

Wow- that worked fantastic! Much Thanks!

I don't suppose making the drop down menus appear to be slightly transparent would be that easy?


(GULP!) Errrm it should be possible. Problem is that it's all hardcoded in the JS file - I had a quick look but I'm not great at Javascript so without fiddling for a couple of hours I couldn't tell you!

If the menus were assigned ids within the JS file then it'd be easy 'cos you could fiddle with the opacity within the stylesheet - but they don't appear to have ids...

My suggestion would be to take a copy of the js file then start fiddling with one of them trying to change the background colour of just the dropdown bit. When you do that then you'll have isolated the right component in the script and you should be able to add in the correct opacity rule in where it's got "<div style="blah blah blah;">"




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
4.296875E-02