Search
Sponsors

Archive for the ‘Images’ Category

Button selector

Friday, January 9th, 2009

<script language=”JavaScript”>
<!–
/* define image width and height */
var pic_width=100;
var pic_height=100;
/* define text to show on button */
button_text=”Next”;
/* define image urls */
if (document.images)
 {
     pic1= new Image(pic_width,pic_height);
     pic1.src=”monday.gif”; 
     pic2= new Image(pic_width,pic_height);
     pic2.src=”tuesday.gif”;
     pic3= new Image(pic_width,pic_height);
     pic3.src=”wednesday.gif”; 
     pic4= new Image(pic_width,pic_height);
     pic4.src=”thursday.gif”; 
     pic5= new Image(pic_width,pic_height);
     pic5.src=”friday.gif”;
 }   
var pics= new Array(5)
   pics[0]=pic1.src;
   pics[1]=pic2.src;
   pics[2]=pic3.src;
   pics[3]=pic4.src;
   pics[4]=pic5.src;

var numpics=5;
var thenum=0;
imgName=”img1″;

function change_it()
 {
   if (document.images)
    {
      document.write(”<IMG SRC=’”+pics[thenum]+”‘ border=’0′ width=’”+pic_width+”‘ height=’”+pic_height+”‘ name=’img1′>\n”);
      document.write(”<BR><FORM><INPUT TYPE=’button’ value=’”+button_text+”‘ onClick=’change_it2()’></FORM>”);
   }
}

function change_it2()
 {
         var x=0;
         thenum+=1;

         if (thenum>numpics-1)
         {
           document[imgName].src=pics[0];
           thenum=0;
           }
         else
         {
           document[imgName].src=pics[thenum];
           x+=1;
          }
 }
//–>
</script>
<SCRIPT language=”JavaScript”>
<!–
 change_it()
//–>
</SCRIPT>

display a random image

Friday, January 9th, 2009

<script language=”JavaScript”>
pic_width=200;   /*change to match the height of all your images */
pic_height=100;   /* change to match the width of all your images */
border_size=0;   /* change to the border size you want on the images */
alignment=1;      /* 0=left,1=center */
/* define image urls */
if (document.images)
 {
     pic1= new Image(pic_width,pic_height);
     pic1.src=”monday.gif”; 
     pic2= new Image(pic_width,pic_height);
     pic2.src=”tuesday.gif”;
     pic3= new Image(pic_width,pic_height);
     pic3.src=”wednesday.gif”; 
     pic4= new Image(pic_width,pic_height);
     pic4.src=”thursday.gif”; 
     pic5= new Image(pic_width,pic_height);
     pic5.src=”sunday.gif”;
 }   

/* no need to edit past this point (unless you want to add more image slots) */

if (alignment==1)
 {
  cent_it=”<CENTER>”;
  cent_it2=”<\/CENTER>”;
 }
else
 {
  cent_it=”";
  cent_it2=”";
 }
 
function get_random(maxNum)
{
  if (Math.random && Math.round)
  {
    var ranNum= Math.round(Math.random()*(maxNum-1));
    ranNum+=1;
    return ranNum;
  }
  else
  {
  today= new Date();
  hours= today.getHours();
  mins=   today.getMinutes();
  secn=  today.getSeconds();
  if (hours==19)
   hours=18;
  var ranNum= (((hours+1)*(mins+1)*secn)%maxNum)+1;
  return ranNum;
  }
}

function get_Image()
{
 if (document.images)
 {
  var choose_one= get_random(5); 
  choose_one–;
  var pics= new Array(5)
   pics[0]=pic1.src;
   pics[1]=pic2.src;
   pics[2]=pic3.src;
   pics[3]=pic4.src;
   pics[4]=pic5.src;

  document.write(cent_it+”<IMG SRC=’”+pics[choose_one]+”‘ width=’”+pic_width+”‘ height=’”+pic_height+”‘ border=’”+border_size+”‘>”+cent_it2);
 }
}
//–>
</script>
<SCRIPT language=”JavaScript”>
<!–
 get_Image()
//–>
</SCRIPT>

an image flip

Friday, January 9th, 2009

<script language=”JavaScript”>
<!–
browserName=navigator.appName;
browserVer=parseInt(navigator.appVersion);

  if ((browserName==”Netscape” && browserVer>=3) || (browserName==”Microsoft Internet Explorer” && browserVer>=4))   
  version=”n3″;
  else
    version=”n2″;

  if (version==”n3″)
   {
     pic1on= new Image(100,25);
     pic1on.src=”monday.gif”; 
     pic2on= new Image(100,25);
     pic2on.src=”sunday.gif”;
    
     pic1off= new Image(100,25);
     pic1off.src=”tuesday.gif”;
     pic2off= new Image(100,25);
     pic2off.src=”thursday.gif”;   
   }

function lightup(imgName)
 {
   if (version==”n3″)
    {
      imgOn=eval(imgName + “on.src”);
      document[imgName].src= imgOn;
    }
 }

function turnoff(imgName)
 {
   if (version==”n3″)
    {
      imgOff=eval(imgName + “off.src”);
      document[imgName].src= imgOff;
    }
 }

//–>
</script>
<A HREF=”index.php” onMouseover=”lightup(’pic1′)” onMouseout=”turnoff(’pic1′)”>
<IMG SRC=”monday.gif” name=”pic1″ width=”100″ height=”25″ border=”0″></A>
<P>
<A HREF=”index.php” onMouseover=”lightup(’pic2′)” onMouseout=”turnoff(’pic2′)”>
<IMG SRC=”sunday.gif” name=”pic2″ width=”100″ height=”25″ border=”0″></A>

a repeating slideshow

Friday, January 9th, 2009

<script language=”JavaScript”>
<!–
/* define image width and height */
var pic_width=100;
var pic_height=100;
/* define image urls */
if (document.images)
 {
     pic1= new Image(pic_width,pic_height);
     pic1.src=”monday.gif”; 
     pic2= new Image(pic_width,pic_height);
     pic2.src=”tuesday.gif”;
     pic3= new Image(pic_width,pic_height);
     pic3.src=”wednesday.gif”; 
     pic4= new Image(pic_width,pic_height);
     pic4.src=”thursday.gif”; 
     pic5= new Image(pic_width,pic_height);
     pic5.src=”friday.gif”;
 }   

/* define text for image captions  */

var destext= new Array(5)
    destext[0]=”This caption for image 1″;
    destext[1]=”This caption for image 2″;
    destext[2]=”This caption for image 3″;
    destext[3]=”This caption for image 4″;
    destext[4]=”This caption for image 5″;
 
var pics= new Array(5)
   pics[0]=pic1.src;
   pics[1]=pic2.src;
   pics[2]=pic3.src;
   pics[3]=pic4.src;
   pics[4]=pic5.src;

var numpics=5;
var thenum=0;
imgName=”img1″;

function change_it()
 {
   if (document.images)
    {
      document.write(”<IMG SRC=’”+pics[thenum]+”‘ border=’0′ width=’”+pic_width+”‘ height=’”+pic_height+”‘ name=’img1′>\n”);
      document.write(”<P><FORM name=’form1′><TEXTAREA name=’text1′ wrap=’virtual’ rows=’5′ cols=’20′>”+destext[thenum]+”</TEXTAREA></FORM>”);
      setTimeout(’change_it2()’,8000); 
   }
}
function change_it2()
 {
         var x=0;
         thenum+=1;
           if (thenum>numpics-1)
             thenum=0;
           document[imgName].src=pics[thenum];
           document.form1.text1.value=destext[thenum];
           x+=1;
           setTimeout(’change_it2()’,8000);     
 }
//–>
</script>
<SCRIPT language=”JavaScript”>
<!–
 change_it()
//–>
</SCRIPT>

an image slide show of 5 images

Friday, January 9th, 2009

<script language=”JavaScript”>
<!–
/* define image width and height */
var pic_width=100;
var pic_height=100;
/* define image urls */
if (document.images)
 {
     pic1= new Image(pic_width,pic_height);
     pic1.src=”monday.gif”; 
     pic2= new Image(pic_width,pic_height);
     pic2.src=”tuesday.gif”;
     pic3= new Image(pic_width,pic_height);
     pic3.src=”wednesday.gif”; 
     pic4= new Image(pic_width,pic_height);
     pic4.src=”thursday.gif”; 
     pic5= new Image(pic_width,pic_height);
     pic5.src=”friday.gif”;
 }   

/* define text for image captions  */

var destext= new Array(5)
    destext[0]=”caption for image 1″;
    destext[1]=”caption for image 2″;
    destext[2]=”caption for image 3″;
    destext[3]=”caption for image 4″;
    destext[4]=”caption for image 5″;
 
var pics= new Array(5)
   pics[0]=pic1.src;
   pics[1]=pic2.src;
   pics[2]=pic3.src;
   pics[3]=pic4.src;
   pics[4]=pic5.src;

var numpics=5;
var thenum=0;
imgName=”img1″;

function change_it()
 {
   if (document.images)
    {
      document.write(”<IMG SRC=’”+pics[thenum]+”‘ border=’0′ width=’”+pic_width+”‘ height=’”+pic_height+”‘ name=’img1′>\n”);
      document.write(”<P><FORM name=’form1′><TEXTAREA name=’text1′ wrap=’virtual’ rows=’5′ cols=’20′>”+destext[thenum]+”</TEXTAREA></FORM>”);
      setTimeout(’change_it2()’,8000); 
   }
}

function change_it2()
 {
         var x=0;
         thenum+=1;

         if (thenum>numpics-1)
         {
           document[imgName].src=pics[0];
           document.form1.text1.value=”The End”;
           }
         else
         {
           document[imgName].src=pics[thenum];
           document.form1.text1.value=destext[thenum];
           x+=1;
           setTimeout(’change_it2()’,8000);
          }
 }
//–>
</script>
<SCRIPT language=”JavaScript”>
<!–
 change_it()
//–>
</SCRIPT

Translate