Results 1 to 4 of 4

Thread: Tom Young!?! Where'd you go?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184

    Post

    Hey Tom!!

    You said you would help me make the random image http page with something called a "rollover" .. You still up to it?

    Compwiz
    posted 11-16-1999 09:41 PM
    ------------------------------------------------------
    Use JavaScript. This can use random images and place them on the page, (for instance: rollovers), and this is more supported than DHTML.
    <script language="JavaScript1.1">
    <!--
    document['myimage'].src = 'c:\mydir\myimage.gif'
    //-->
    </script>

    is a cheap example. If you want one that is random and etc., then just let me know.


  2. #2
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    Yeah... sorry. I was away. Unforunately, JavaScript cannot read and write to the drive because of security, but if you define the images, then you are alright. Here is an example:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    
    <html>
    <head>
    	<title>My Random Image Page</title>
    	<script language="JavaScript">
    	<!-- Start Hiding From Old Browsers
    	/*	Random Images
    		Made By Tom Young
    		11/19/99 */
    	
    	images = new Array(10) // Make an array with the images
    	myDir = 'file:///c|/mydir/' // This can also be a web path like: /~mymembername/images/
    						// INCLUDE TRAILING SLASH ALSO!
    						// FOR BACKSLASHES, YOU MUST USE TWO OF THEM
    	images[0] = 'image1.gif'; // Define Images
    	images[1] = 'image2.gif';
    	images[2] = 'image3.gif';
    	images[3] = 'image4.gif';
    	images[4] = 'image5.gif';
    	images[5] = 'image6.gif';
    	images[6] = 'image7.gif';
    	images[7] = 'image8.gif';
    	images[8] = 'image9.gif';
    	images[9] = 'image10.gif';
    	
    	function printImage() { //Make funtion for the printing of the image
    		imageIndex = Math.floor(Math.random() * images.length); // Get a random number from the number of images
    		document.writeln("<img src=\"" + myDir + images[imageIndex] + "\" border=\"0\">") // Print the random image.
    	}
    	//-- Stop Hiding From Old Browsers-->
    	</script>
    </head>
    <body>
    Here is the random image:
    <script language="JavaScript">
    <!--
    printImage();
    //-->
    </script>
    
    </body>
    </html>
    Like I said, you can have JavaScript read the directory, just get the image(s) you specify.

    Let me know if this suits your needs.

    ------------------
    Tom Young, 14 Year Old
    tyoung@stny.rr.com
    ICQ: 15743470 Add Me ICQ Me
    AIM: TomY10
    PERL, JavaScript and VB Programmer

    [This message has been edited by Compwiz (edited 11-19-1999).]

  3. #3
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    And this one is for rollovers:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    
    <html>
    <head>
    	<title>My Random Image Page</title>
    	<script language="JavaScript">
    	<!-- Start Hiding From Old Browsers
    	/*	Random Images by Rollover
    		Made By Tom Young
    		11/19/99 */
    	
    	images = new Array(10) // Make an array with the images
    	myDir = 'file://c|/mydir/' // This can also be a web path like: /~mymembername/images/
    						// INCLUDE TRAILING SLASH ALSO!
    	images[0] = 'image1.gif'; // Define Images
    	images[1] = 'image2.gif';
    	images[2] = 'image3.gif';
    	images[3] = 'image4.gif';
    	images[4] = 'image5.gif';
    	images[5] = 'image6.gif';
    	images[6] = 'image7.gif';
    	images[7] = 'image8.gif';
    	images[8] = 'image9.gif';
    	images[9] = 'image10.gif';
    	
    	function rollImage(image) { //Make funtion for the printing of the image
    		imageIndex = Math.floor(Math.random() * images.length); // Get a random number from the number of images
    		document[image].src = myDir + images[imageIndex]
    	}
    	function rollOut(originalImage, image) {
    		document[image].src = originalImage
    	}
    	//-- Stop Hiding From Old Browsers-->
    	</script>
    </head>
    <body>
    Here is the random image rollover:
    <a href="mypage.html" onMouseOver="rollImage('myimage')" onMouseOut="rollOut('file:///c:/temp/image0.jpg', 'myimage')"><img src="file:///c|/temp/image0.jpg" border="0" name="myimage"></a>
    </body>
    </html>
    ------------------
    Tom Young, 14 Year Old
    tyoung@stny.rr.com
    ICQ: 15743470 Add Me ICQ Me
    AIM: TomY10
    PERL, JavaScript and VB Programmer

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184

    Post

    Tom,

    Thank you for the html code.
    Bubye.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width