JavaScript streamlined learning 3: Image

Related Tags:

  Read image attributes 36 
  1: <img src="image1.jpg" name="myImage"> 
  2: <a href="# "onClick="window.alert(document.myImage.width)"> Width </ a> 
3:

  37 dynamically loaded image 
  1: <script language="JavaScript"> 
  2: myImage = new Image; 
  3: myImage.src = "Tellers1.jpg"; 
  4: </ script> 

  38 simple image replacement 
  1: <script language="JavaScript"> 
  2: rollImage = new Image; 
  3: rollImage.src = "rollImage1.jpg"; 
  4: defaultImage = new Image; 
  5: defaultImage.src = "image1.jpg"; 
  6: </ script> 
  7: <a href = "myUrl" onMouseOver = "= rollImage.src document.myImage.src;" 
  8: onMouseOut = "defaultImage.src document.myImage.src ="> 
  9: <img src="image1.jpg" name="myImage" width=100 height=100 border=0> 

  39 random images 
  1: <script language="JavaScript"> 
  2: var imageList = new Array; 
  3: imageList [0] = "image1.jpg"; 
  4: imageList [1] = "image2.jpg"; 
  5: imageList [2] = "image3.jpg"; 
  6: imageList [3] = "image4.jpg"; 
  7: var imageChoice = Math.floor (Math.random () * imageList.length); 
  8: document.write ( '<img src="' imageList[imageChoice]'">'); 
  9: </ script> 

  40 Image Replacement Functions 
  1: <script language="JavaScript"> 
  2: var source = 0; 
  3: var replacement = 1; 
  4: function createRollOver (originalImage, replacementImage) ( 
  5: var imageArray = new Array; 
  6: imageArray [source] = new Image; 
  7: imageArray [source]. Src = originalImage; 
  8: imageArray [replacement] = new Image; 
  9: imageArray [replacement]. Src = replacementImage; 
  10: return imageArray; 
  11:) 
  12: var rollImage1 = createRollOver ( "image1.jpg", "rollImage1.jpg"); 
  13: </ script> 
  14: <a href = "#" onMouseOver = "document.myImage1.src = rollImage1 [replacement]. Src;" 
  15: onMouseOut = "document.myImage1.src = rollImage1 [source]. Src;"> 
  16: <img src="image1.jpg" width=100 name="myImage1" border=0> 
  17: </ a> 

  Create slide 41 
  1: <script language="JavaScript"> 
  2: var imageList = new Array; 
  3: imageList [0] = new Image; 
  4: imageList [0]. Src = "image1.jpg"; 
  5: imageList [1] = new Image; 
  6: imageList [1]. Src = "image2.jpg"; 
  7: imageList [2] = new Image; 
  8: imageList [2]. Src = "image3.jpg"; 
  9: imageList [3] = new Image; 
  10: imageList [3]. Src = "image4.jpg"; 
  11: function slideShow (imageNumber) ( 
  12: imageList document.slideShow.src = [imageNumber]. Src; 
  13: imageNumber = 1; 
  14: if (imageNumber <imageList.length) ( 
  15: window.setTimeout ( "slideShow (" imageNumber ")", 3000); 
  16:) 
  17:) 
  18: </ script> 
  19: </ head> 
  20: <body onLoad="slideShow(0)"> 
  21: <img src="image1.jpg" width=100 name="slideShow"> 

  42 random advertising picture 
  1: <script language="JavaScript"> 
  2: var imageList = new Array; 
  3: imageList [0] = "image1.jpg"; 
  4: imageList [1] = "image2.jpg"; 
  5: imageList [2] = "image3.jpg"; 
  6: imageList [3] = "image4.jpg"; 
  7: var urlList = new Array; 
  8: urlList [0] = "http://some.host/"; 
  9: urlList [1] = "http://another.host/"; 
  10: urlList [2] = "http://somewhere.else/"; 
  11: urlList [3] = "http://right.here/"; 
  12: var imageChoice = Math.floor (Math.random () * imageList.length); 
  13: document.write ( '<a href="' urlList[imageChoice]'"> <img src="' imageList[imageChoice]'"> </ a>'); 
  14: </ script> 

Related articles:

XHTML document hierarchical structure of the DOM
  Window    Frame    Location    History    Document    Div    Link    Image    Clip    Anchor    Applet    Form    Text    Password    Hidde...
On page designer color: cute, fun, interesting
  102 r 204 r r 255 g 204 g255 g 153 b 204 b 102 b 66cccc # 204 # ccff66 # ff99cc r 255 r 255 r 255 g 153 g255 g 204 b 153 b 255 b 153 # ff9999 # ffffff # ffcc99 r 255 r 255 r 153 g 102 g 255 g 204 b 102 b 102 b 102 # ff6666 # ffff66 # 99cc66 r 102 r 255 r 255 g 102 g255 g 153 b 153 b 255 b 153...
CSS style Import
  (1) style into related    Graphical style into dengan http://bbs.dvbbs.net/dispbbs.asp?BoardID=102&ID=927456&replyID=&skin=1 style into video http://bbs.dvbbs.net/dispbbs.asp?boardID=102&ID = 971287 & page = 2 fixed network solution can not delete the default s...
X-Spacee and Discuz! Integrated explain Forum
  X-Spacee and Discuz! Integrated explain Forum    X-Space Web2.0 community is a personal portal system.    BLOG it to function as the core, with a picture (Album), the collection of bookmarks (net extraction), and other friends circle Web2.0 application elements, as well ...
DIV + CSS layout of a small problem solution
  Today, a man named kingcms (http://www.kingcms.com) system to the web article to the department Website.    Examples of its reference to the template themselves DIV + CSS for the layout.    Feeling than their own page with a more strenuous ASP.    Also want to l...