View Full Version : can i use java IN css?
helpless
04-08-2003, 07:12 PM
hi, ive got a question, but im not sure in which thread it should be postet. so here:
i made a page where css is used, but now i want the links to fade out when you "a:hover". so i wrote it in java. now i want to include the java (perhaps over an url?) to the css. can someone help me please?
thanks
Spookster
04-08-2003, 07:19 PM
Are you referring to Java or Javascript? They are two different things.
helpless
04-08-2003, 07:22 PM
damn, outed,
:)
i ment Javascript
liorean
04-08-2003, 07:25 PM
NN4 and IE has their own proprietary ways of allowing javascript in css. There's no way in the css specs (yet) though.
I'd advice not to use it - what if a user has css enabled but not javascript, for instance?
[yay - this is my 300th post. I'm now officially a CF Addict!]
helpless
04-08-2003, 07:26 PM
:( thanks
brothercake
04-08-2003, 07:43 PM
You can use DHTML behaviors for IE5/6, and moz has a bindings language called XBL - in both cases, what they do is allow you to attach scripted behaviors to elements, or classes, or whatever.
You could also bind functions call to all instances of an element in a normal JS script - that would probably be the simplest and most x-browser way. Something like
window.onload = function()
{
if(typeof document.getElementsByTagName!="undefined")
{
//get <a> tags collection
var aTags = document.getElementsByTagName('a');
var aTagsLen = aTags.length;
for (var i=0;i<aTagsLen;i++)
{
//attach events
aTags[i].onmouseover = mouseoverFunction;
aTags[i].onmouseout = mouseoutFunction;
}
}
}
helpless
04-08-2003, 07:49 PM
thanks for your help, but there are a 2 problems:
1. i dont speak such a good english, so i dont understand all.
2. i made the page with postnuke, so i dont have html-pages(not really)
could u explain me step for step the last "simplest way"? please.
There is Netscape 4's JSSS and microsoft's expressions... *ducking* :D
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.