Helpful Information
 
 
Category: HTML & CSS
Wierd thingy.

Im not sure if this is possible, but hey...

I have a picture, right? And when someone clicks on it a RANDOM message appears next to it. Is it possible?

Hello

I have adapted this script (http://www.javascriptkit.com/script/script2/punchline.shtml) from JavaScript Kit, here it is:



<table>
<tr>
<td>
<div onclick="randomdisplay()" style="cursor: crosshair">
<img src="IMAGE.jpg" alt="Click to display a random quote">
</div>
</td>

<td>
<form name="scriptform">
<textarea name="scriptinput" cols="20" rows="5" style="border:0;background-color:#FFFFFF;font-family: verdana; color:#000000; font-size: 12pt;"></textarea>
</form>
</td>
</tr>
</table>
<script>

//Satirical Punch Line Script- by javascriptkit.com (text by Colin Lingle)
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use

quotes = new Array();
quotes[0]="Warning: Dates in Calendar are closer than they appear.";
quotes[1]="Daddy, why doesn't this magnet pick up this floppy disk?"
quotes[2]="Give me ambiguity or give me something else."
quotes[3]="I.R.S.: We've got what it takes to take what you've got!"
quotes[4]="We are born naked, wet and hungry. Then things get worse."
// ADD MORE HERE IF YOU WANT

function randomdisplay(){
randomquote=quotes[Math.floor(Math.random()*quotes.length)]
document.scriptform.scriptinput.value=randomquote
}

setTimeout("randomdisplay()",100)

</script>

<p align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript
Kit</a></font></p>


add as many quotes as you want, and remember to change "IMAGE.jpg" to the url of your image.

good luck :thumbsup:

good quotes :)!










privacy (GDPR)