Jump to content

Do you think this would work? [Question]


Mudsaf

Recommended Posts

So the basic idea, in the webpage there would be example <span id="Images"></span> and the images should go inside. For example if the count = 0 the image 0.jpg would go inside span. Example2 if the count =1 image 1.jpg would go inside span. Im just asking does this look like it would work? Haven't tested yet.

// JavaScript Documentvar count = 0;function image()  {var img = document.getlementById("Images").innerHTML='<img src="/includes/images/' && count && '.jpg " width="800" height="600" />';}function nextimage() {count = count + 1;}function previousimage() {if (count = 0) {alert("You are already in beginning of images, you can't go back");} else {count = count -1;}}

Link to comment
Share on other sites

somehow i can't get even this working O.o

<html><head> <script type="text/javascript">document.getElementById("peanut").innerHTML="ABC";</script></head><body> <span id="peanut"></span> </body></html>

Fixed, required button to call function

Link to comment
Share on other sites

This progress working so far!

<html><head><script type="text/javascript">count = 0;var url = "<img src='includes/images/";var imageending = ".jpg'";var stats = " width='800' height='600' />";var everything = (url + count + imageending + stats);function start() {document.getElementById("images").innerHTML=(everything);} function nextimage() {count = count + 1;var url = "<img src='includes/images/";var imageending = ".jpg'";var stats = " width='800' height='600' />";var everything = (url + count + imageending + stats);document.getElementById("images").innerHTML=(everything);// "<img src='includes/images/'" && count && '.jpg' && "width='800' height='600' />"; } </script></head><body onLoad="start();"><span id="images"></span><input name="button" value="Previous" type="button" onclick="previousimage();"><input name="button" value="Next" type="button" onclick="nextimage();"></body></html>

Link to comment
Share on other sites

Thanks all for helping me with this problem. Feel free to use this code anywhere, not even single line leeched anywhere & feel free to edit if needed!

<html><head><script type="text/javascript">count = 0;var url = "<img src='includes/images/";var imageending = ".jpg'";var stats = " width='800' height='600' />";var everything = (url + count + imageending + stats);function start() {document.getElementById("images").innerHTML=(everything);} function nextimage() {count = count + 1;var url = "<img src='includes/images/";var imageending = ".jpg'";var stats = " width='800' height='600' />";var everything = (url + count + imageending + stats);document.getElementById("images").innerHTML=(everything);}function previousimage() {if (count == 0) {alert("You already on startpage");} else {count = count - 1;var url = "<img src='includes/images/";var imageending = ".jpg'";var stats = " width='800' height='600' />";var everything = (url + count + imageending + stats);document.getElementById("images").innerHTML=(everything);}}</script></head><body onLoad="start();"><span id="images"></span><input name="button" value="Previous" type="button" onclick="previousimage();"><input name="button" value="Next" type="button" onclick="nextimage();"></body></html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...