Question:
Quick Javascript question. Should be easy..?
anonymous
1970-01-01 00:00:00 UTC
Quick Javascript question. Should be easy..?
Five answers:
matthew1585
2013-02-03 22:07:56 UTC
You could use a modal, or you might be interested in a lightbox, like this: http://www.goldenpipes.net/mega-pack/
John
2013-02-03 19:58:27 UTC
try this out...





Dynamic Image Viewer









dynamic images

one





Jim
2013-02-03 19:50:00 UTC








My Blog



















Robert
2013-02-03 19:47:05 UTC
Rewrite the Javascript as (putting back in the bits I cannot see in the var x = bit):



function changePic(inth) {

var x = "https://www.google.com/images/srpr/logo…



if (inth.indexOf("one") != (0 - 1))

document.getElementById(inth).src = x;

else if (inth.indexOf("two") != (0 - 1))

document.getElementById(inth).src = x;

else if (inth.indexOf("three") != (0 - 1))

document.getElementById(inth).src = x;

}
>.>
2013-02-03 19:47:45 UTC
It's a parameter issue.



'function changePic(one, two, three)'

should just be

'function changePic(picture)'



And the switch should be something along the lines of:

if (picture == "one")

{

document.getElementById(one).src = x;

}

etc,



The function takes three parameters (one, two, three) and you're only plugging in a single parameter (one), (two), or (three). Also, you're plugging in strings, and the switch is checking for variables.



That is to say, "one" does not equal one.

one is a variable name "one" is a string value.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...