Click to See Complete Forum and Search --> : random quote pop up
beers
12-18-2003, 08:40 AM
ok, im new here.
and i know very little about java script...but im learning.
ive been looking for a script that when triggered by a link...will pop up an alert box or something that will contain a random quote from a whole list of them that i write up.
i used the search here...but couldn't narrow it down enough...
can anyone help???
thanks again :D
gordon.
fredmv
12-18-2003, 08:42 AM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>untitled</title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" />
<script type="text/javascript">
//<![CDATA[
var q =
[
'Quote 1',
'Quote 2',
'Quote 3',
'Quote 4',
'Quote 5'
];
//]]>
</script>
</head>
<body>
<div>
<a href="#" onclick="alert(q[Math.floor(Math.random()*q.length)]);">Display a random quote.</a>
</div>
</body>
</html>
beers
12-18-2003, 08:44 AM
wow. that was like super fast.
thank you sooo very much.
and to whom can i credit this to???
fredmv
12-18-2003, 08:45 AM
Originally posted by beers
thank you sooo very much.You're very welcome. :DOriginally posted by beers
and to whom can i credit this to???Me. ;)
beers
12-18-2003, 08:50 AM
sweeeeeeet
ill msg PM ya when i get my site workin right
and you can see that code in action :D
thanks again man
fredmv
12-18-2003, 08:52 AM
You're welcome. :D