OK i have about 500 .html files and in each of the .html files is a funny picture which is hyperlinked to the page on my website with that funny picture on it. I want to offer a script that other people can put on there websites which will show a differant .html file on their .... homepage for example every day. This will mean there homepage displays a differant funny picture ( 150 x 100 ) with a hyperlink to my website on it each day. Something like this >> http://www.go-mrav.com/files/jsweben.shtml On this page look for "Add funny picture of the day to your website!" Does anyone know how to do this please ..... I have been searching for this answer for weeks now. Someone please talk me through it or point me in the direction of a tutorial. Thankyou
basically you tell people to put this on their web site: <script language="JavaScript" src="http://www.yoursite.com/random.js"></script> and in random.js you can use this script i built on my one site: function random_text() {}; var random_text = new random_text(); // Set the number of text strings to zero to start var number = 0; // Incremental list of all possible Text random_text[number++] = 'text1' random_text[number++] = 'text2' random_text[number++] = 'text3' random_text[number++] = 'text4' random_text[number++] = 'text5' // Create a random number with limits based on the number // of possible random text strings var random_number = Math.floor(Math.random() * number); // Write out the random text to the browser document.write(random_text[random_number]); Code (markup): basically where you have text1, text2, etc you put the HTML you want displayed on people sites, and this will randomly pick from all the lines something to display... you can see it live at http://www.mygta.net it randomly pulls quotes up on the top middle part of the page I just realized you probably just want the JS to pull the contents of the HTML files to display on the sites instead of going back to all 500 files and loading that text into javascript variables. So you will need to find a way of reading in the HTML from those files into the variables, but this would be a start... you can PM me if you want to talk about it some more