Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    function not defined?

    Hello,

    I don't understand why this function is not defined:

    Code:
    		function swapimg(in)
    		{
    			alert(in);
    			var imgname;
    			imgname  = in;
    			window.parent.document.getElementById('ifrmtarget').src="images/" + in + ".jpg";
    		}
    I'm calling it like this:

    <a href="#" onclick="swapimg(00)" >

    If you see the problem, would you please let me know.

    Thanks,

    Jason

  • #2
    Regular Coder Stooshie's Avatar
    Join Date
    Mar 2008
    Location
    Dundee, Scotland
    Posts
    378
    Thanks
    9
    Thanked 39 Times in 39 Posts
    you can't use the variable name in, it's a reserved word.
    Code:
    function swapimg(testin)
    {
    	alert(testin);
    	var imgname;
    	imgname  = testin;
    	window.parent.document.getElementById('ifrmtarget').src="images/" + testin + ".jpg";
    }
    Regards, Stooshie
    O


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •