dynamic refresh of a random quote
do i have to refresh the whole page? or can i make it so that only the quote at the top refreshes?
try it out, it chooses a random quote each time you visit, from my list of quotes
Nathan Bell
NateBell.com
do i have to refresh the whole page? or can i make it so that only the quote at the top refreshes?
try it out, it chooses a random quote each time you visit, from my list of quotes
Nathan Bell
NateBell.com
jonsteele posted this at 02:43 — 5th March 2001.
They have: 21 posts
Joined: Nov 2000
Hi,
I don't know about refeshing the top only, but you could achieve the same effect using a couple of different ways...
1) If your list of quotes is not too long (i.e. 6 or so), you could make 6 (or so) div tags on top of each other, then periodically hide/show them to change the quote at the top.
2) You could put the quote in a div and then change the text in the div periodically (using innerHTML).
3) Use a form input field to change it. You could make the input field look fancy (that is, not like a regular form field)
Which way do you wanna try?
Jon.
Jon Steele -
EverySolution.com
natebell posted this at 03:00 — 5th March 2001.
They have: 33 posts
Joined: Mar 2001
hmm, sounds too complicated
i had seen some moving text before on a site and thought it would be possible to just get a random quote to pop up every so often, i have way more than six and it grows every day:)
Nathan Bell
NateBell.com
jonsteele posted this at 23:51 — 5th March 2001.
They have: 21 posts
Joined: Nov 2000
The 2nd method seems the best way to go. Here's the cross-browser code. Put this in your head tag:
function showquote(){
if (document.layers){
document.layers['quote'].open();
document.layers['quote'].document.write(showQuote());
document.layers['quote'].close();
}else if(document.getElementById){
document.getElementById("quote").innerHTML = showQuote();
}else{
document.all['quote'].innerHTML = showQuote();
}
}
Then where you want to show your quote put this:
<div id="quote" style="position:absolute; left:10;top:10">
<script>
showquote();
setInterval("showquote()",10000)
</script>
</div>
The positioning has to be absolute for NN4.
Jon.
Jon Steele -
EverySolution.com
natebell posted this at 03:52 — 7th March 2001.
They have: 33 posts
Joined: Mar 2001
i am not understanding this entirely.
showquote() is recursive, what does it actually show?
i have a randomQuote() function that i have made that returns a string that i can them manipulate anywhere in my html. but i am not understanding where this fits into the code you gave me:)
where do i put the actual quote?
i also get a stack overflow at line 16 which i think is:
document.getElementById("quote").innerHTML = showquote();
if i give you the randomQuote() function that returns a random quote what can ya do with it!
thanks,
Nathan Bell
NateBell.com
jonsteele posted this at 22:21 — 7th March 2001.
They have: 21 posts
Joined: Nov 2000
Sorry the "showquote()"'s in the showquote function should be "randomQuote()" (your function). Like this:
function showquote(){
if (document.layers){
document.layers['quote'].open();
document.layers['quote'].document.write(randomQuote());
document.layers['quote'].close();
}else if(document.getElementById){
document.getElementById("quote").innerHTML = randomQuote();
}else{
document.all['quote'].innerHTML = randomQuote();
}
}
This should work. I tested it on IE5.5, Netscape 4.75 and Netscape 6.
Jon.
Jon Steele -
EverySolution.com
natebell posted this at 23:45 — 7th March 2001.
They have: 33 posts
Joined: Mar 2001
it does show the quote, but only refreshes when i use the refresh button
maybe setInterval isn't working
if i understand it correct, setInterval(function(), int interval)
but it doesn't seem to dynamically refresh the div, i set it to 10, and even 1, with no luck.
thanks for your help,
want me to send you the quotes.js that creates the randomQuote()?
Nathan Bell
NateBell.com
natebell posted this at 23:57 — 7th March 2001.
They have: 33 posts
Joined: Mar 2001
i am dumb, forgot quotations around first arg of setInterval
thanks jon:):)
jonsteele posted this at 02:13 — 8th March 2001.
They have: 21 posts
Joined: Nov 2000
Glad to see it working. Is it up yet? I'd like to see it on your site .
jonsteele posted this at 02:23 — 8th March 2001.
They have: 21 posts
Joined: Nov 2000
Okay, I had a look at it. I think you should know that in NN4.75 your site looks NOTHING like it does in IE: top banner (quotes and logo) are not there, background and text are screwed up.
For the to change in NN4+, it HAS to be absolute positioned (not relative).
Jon.
Jon Steele -
EverySolution.com
natebell posted this at 02:26 — 8th March 2001.
They have: 33 posts
Joined: Mar 2001
i know, i am working on it now, but i am going to give up with netscape, you can't even use class="something" can you?
and why doesn't backgrounds go to the edges?
if i change the position to absolute will it still be displayed at the top, or do i have to position it with left and top?
thanks
Nathan Bell
NateBell.com
jonsteele posted this at 02:41 — 8th March 2001.
They have: 21 posts
Joined: Nov 2000
You will have to use left and top. But this should not affect how you want to position it. With a little JavaScript, you can get it positioned to the right, center, etc. on any resolution.
classes do work in NN. You just can't use them EVERYWHERE liek you do in IE. For example, in NN, they doin't work in table tags but DO work in td tags.
Post your stylesheets and I'll see if I can help.
Jon.
Jon Steele -
EverySolution.com
Suzanne posted this at 03:31 — 8th March 2001.
She has: 5,507 posts
Joined: Feb 2000
Classes work in most elements in Netscape (even tables) but not all declarations in them will work. For instance there are compatibility issues between borders and padding in some elements (A tag for instance).
For more on that, check out:
http://www.webreview.com/style/css1/charts/mastergrid.shtml
Suzanne
natebell posted this at 03:55 — 8th March 2001.
They have: 33 posts
Joined: Mar 2001
i am having trouble getting class atribute to work
i'll post my style sheets
of course it is in http://www.natebell.com/styles/nates.css i do believe
Nathan Bell
NateBell.com
natebell posted this at 03:59 — 8th March 2001.
They have: 33 posts
Joined: Mar 2001
http://www.natebell.com/nates.txt
natebell posted this at 04:10 — 8th March 2001.
They have: 33 posts
Joined: Mar 2001
class element seems to be working for the generated quotes
class="author" and class="quote" but not on my links class="quick"
any ideas about that?
and i can't seem to get the blasted div tag to display in my banner section on IE it is off the side, you can highlight it, and NS i can' find it in there, it is position:absolute
aaaahhhh:(
Nathan Bell
NateBell.com
Suzanne posted this at 05:19 — 8th March 2001.
She has: 5,507 posts
Joined: Feb 2000
Check for other threads on the topic, but you have to explicitly declare the a tag attributes...
a.quick:hover
The :hover pseudo class is only valid for the A tag.
Additionally, there is an order that they have to be in -- check the other posts on this in this forum, as there is some debate on the correct order.
Also, :hover doesn't work in Netscape 4.x browsers, but it doesn't break, either. Don't worry about it.
Suzanne
natebell posted this at 13:43 — 8th March 2001.
They have: 33 posts
Joined: Mar 2001
thanks
jonsteele posted this at 02:26 — 9th March 2001.
They have: 21 posts
Joined: Nov 2000
Hi,
Don't put the quote div in a table. Put it by it self at the beginning or end. Since you're giving it left/top values, it won't matter. NN doesn't like divs in tables.
Why do you use classes in EM tags? Why not in font tags? I'm not too sure about the support for em tags in NN (the "NATEBELL.COM" at the top is not showing properly, try putting the class in the a tag or a font tag).
Jon.
Jon Steele -
EverySolution.com
natebell posted this at 03:20 — 9th March 2001.
They have: 33 posts
Joined: Mar 2001
i tried the font tag, and the a tag, doesn't seem to work on netscape
and the quote doesn't refresh on NS either
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.