/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Add this in your <head> <script language="javascript" type="text/javascript" src="/js/refresh/refresh.js"></script> Add this in your <body> <script language="javascript" type="text/javascript"> showText();//Shows Random Text on refresh </script> // JavaScript Document // Set up the text files to be used. var theText = new Array() // do not change this theText[0] = 'Test 1'; theText[1] = '"Test 2"'; theText[2] = '<a href="#" title="test 3">Test 3</a>'; // do not edit anything below this line var j = 0 var p = theText.length; var preBuffer = new Array() for (i = 0; i < p; i++){ preBuffer[i] = new Array() preBuffer[i].src = theText[i] } var whichText = Math.round(Math.random()*(p-1)); function showText(){ //This a wrapper for the text array it can be changed if need document.write('<p class="thetext">'+theText[whichText]+'</p>'); }
URL: http://www.brendadansby.com/
Comments
