Click to See Complete Forum and Search --> : 2 questions


lex'el
01-09-2004, 03:15 PM
I need some help for these couple of problems:

I need a script to display stuff from a different file than the page so that I can change menus without having to go and change every page every time I need to do something. If possible from another html. **found answer in another post**

I also need a script to get some text scrolling across the screen (for the news). This one also needs to be on a separate file so that I can edit it whenever I want.

By now, you all probably figured out I don't really know anything about javascript, so please explain what I hate to do to make this work.

Oh ya, can someone post how to make rollovers with text.

Thanks in advance.

LEX'EL

steelersfan88
01-11-2004, 01:28 PM
To have text scrolling across the page as in a news scroller,
run a marquee from an extrenal javascript file (news.js).
The news.js file should include:


var marquee_news = ""
var marquee_width = ""
var marquee_bgcolor = ""
var marquee_textcolor = ""

document.write('<marquee width="'+ marquee_width +'" bgcolor="'+ marquee_bgcolor +'"><font color="'+ marquee_textcolor +'">'+ marquee_news +'</marquee>')

The news, width, bgcolor, and textcolor should
be filed by the variables.

Wherever you need the marquee, simply
enter the line of javascript:


<script language="javascript" src="news.js"></script>

Whenever you need to edit, just change the
news within the news.js file.

David Harrison
01-11-2004, 03:01 PM
I'll take care of the text rollovers then shall I? Well when you said rollovers, I assumed that you meant the text changes colour or gets underlined or something, rather than the text changing to something else.

This can be done without the aid of JavaScript but only if the text you want to change is a link. (I can't see why you would want the text to change if it wasn't a link though).

I'll explain how it works. This is the CSS bit:

<style type="text/css"><!--

a.change, a.change:link, a.change:visited{
color:#ff0000;
text-decoration:none;
background-color:#eeeeee;
}

a.change:focus, a.change:hover, a.change:active{
color:#ffff00;
text-decoration:underline;
background-color:#999999;
}

--></style>The first block of rules describe the link as it appears not rolled over and the second block of rules descirbe the link how it should look once it is rolled over.

The "a.change" bit that you see all over the place is a selector that means anchor <a></a> tags that are in the class "change". Then on 5/6 of the selectors you may see a colon and a word, don't worry about these, they are just the various states that a link can be in.

For your links, (the one's you want to change that is), do this:

<a href="#" class="change">Rollover me!!!</a>

Obviously change the href to what you want, but always make sure you have the class="change" in there, otherwise it will be just another normal link.

If you want to have all of the links on your site change but you don't want to bother adding class="change" to them all then you could do this:

<style type="text/css"><!--

a, a:link, a:visited{
color:#ff0000;
text-decoration:none;
background-color:#eeeeee;
}

a:focus, a:hover, a:active{
color:#ffff00;
text-decoration:underline;
background-color:#999999;
}

--></style>

<a href="#">Rollover me!!!</a>But remember, this will affect ALL LINKS.