Reputation: 39
I have the code below,but I don't get the pictures to be fade and replace
I see the I'm getting on the firebug console :
"missing ) after argument list" and also when I click on the function changeBg the console say that "changeBg is not defined"
JS:
<script language="JavaScript">
function changeBg (color) {$("#mainimg1).attr("src",Images/"+color+".jpg).fadeIn(3000)};
</script>
HTML
<img id="mainimg1" src="Images/black.jpg">
<img src="Images/blue.png" onclick="changeBg(this.name);" name="blue">
<img src="Images/fuksia.png" onclick="changeBg(this.name);" name="fuksia">
<img src="Images/brown.png" onclick="changeBg(this.name);" name="brown">
Thanks.
Upvotes: 0
Views: 153
Reputation: 360672
You've forgotten a "
, unbalancing the statement
function changeBg (color) {$("#mainimg1).attr("src",Images/"+color+".jpg).fadeIn(3000)};
^--- missing " here ^--and here (thanks Johnny)
Upvotes: 1