Jump to content

James92

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by James92

  1. How would I do this exactly? Using JQuery change the background color of the header tag to the color represented by hex value #336 (#333366)
  2. It's a mix of both but for this certain part it has to be only JavaScript Source Code <img id="img2" src="batsignal.jpg"> JS Code function preloadImages(){ var pictures = g.batmanImages.concat(g.batmanImages, g.signImages); var tempImage = new Image(); for (var i=0; i<pictures.length; i++){ tempImage.src = pictures; }}function slideShow(){ if (g.slideShow){ clearInterval(g.slideShow); g.slideShow = null; } else { g.slideShow = setInterval(changeSlide,5000); }}function changeSlide(){ g.slideCtr++; if (g.slideCtr > g.batmanImages.length-1){ g.slideCtr = 0; } img2.src = g.batmanImages[g.slideCtr]; g.img2 = document.getElementById("img2"); g.slideShow = 0; g.slideCtr = 0; g.x = null; g.y = null; g.objX = null; g.objY = null;}g.img2.onclick = slideShow;g.batmanImages = ["batsignal.jpg", "batmobile.jpg", "batmanflying.jpg"];
  3. a. Select one of the images to load automatically when the web page loads by modifying the HTML and placing a file name in the empty src property of the img tag with id="img2"b. Using JavaScript write the necessary functions to start the slideshow automatically and continuously cycle through the selected images displaying each one for 5 seconds.I don't know what I'm missing in my coding to make it work?Here's my entire websitehttp://jsfiddle.net/eqkhgxcL/
  4. How would I define my addEvent() and changeBatman() functions? and I changed around my code a bit. I got the jQuery library in my page jquery-1.11.1.min.js file is attached. Source Code <img id="img1" src="batman.jpg"> JS Code addEvent(g.batman, "mouseover", changeBatman); addEvent(g.batman, "mouseout", changeBatman); $("#img1").mouseover(rollover);$("#img1").mouseout(rollover); function rollover(){ if (img1.src.slice(img1.src.lastIndexOf("/")+1) == g.batmanImages[0]){ img1.src = g.batmanImages[1]; } else { img1.src = g.batmanImages[0]; } }var g = {} g.batmanImages = ["batman.jpg", "batman2.jpg"];
  5. Choose 2 images to build a Rollover effect on the image tag that has id="img1". Using JavaScript complete the following tasks;a. select one of the two images to load automatically when the web page loads by modifying the HTML and placing a filename in the empty src property of the img tag with id="img1"b. setup an event that will call a function when the user places the mouse over the imagec. setup an event that will call the same function as in step b above (I.E. both events will call the same function) when the mouse moves off of the imaged. the function called in steps b and c above should handle changing the image displayed in img tag with id="img1" when the mouse is placed over it to the second image you chose, and then changing it back to the original image when the mouse moves off itHere's my code it's not working I dunno why?Source Code<img id="img1" src="batman.jpg">JS CodeaddEvent(g.batman, "mouseover", changeBatman);addEvent(g.batman, "mouseout", changeBatman);$("#img1").mouseenter(rollover).mouseleave(rollove r);function rollover() {var img1=thisif ($(img1).attr("src") == g.batmanImages[0]) {img1.src = g.batmanImages[1];} else {img1.src = g.batmanImages[0];}}var g = {}g.batmanImages = ["batman.jpg", "batman2.jpg"];
  6. Using JQuery have the section with id="first" suddenly appear in the browser window I did this Source Code <section id="first"> <!-- use for Ajax --> <form method="get" action="" id="add1"> <fieldset> JS Code $(document).ready(function(){ $("first").show(); }); Don't understand why it's not working :s?
×
×
  • Create New...