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
    Jun 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Pass Variable and Use in Function

    Hello,

    I do very little work with Javascript, but I'm sure this is an easy one...

    I'm trying to jump to a dynamically-named anchor when the page loads but I'm just not sure of the correct syntax to use when passing the anchor name to the function.

    This is what I have in the HEAD of the page: (Something is wrong with this is my guess)

    Code:
    <script type="text/javascript" language="javascript">
    	function moveWindow(AnchorName){window.location.hash='AnchorName';}
    </script>
    This is the call to the function with the dynamic anchor name, and is placed before the </body> tag.

    Code:
    <script type="text/javascript"><!--
    moveWindow("comment");
    //-->
    </script>
    How do I correctly pass(or correctly use the passed) the anchor name "comment" to the moveWindow() function?

    Thanks for any and all help!

    Peter
    Last edited by peterallcdn; 10-16-2008 at 07:48 PM.

  • #2
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Never mind, I'm an idiot, I got it...

    Code:
    <script type="text/javascript" language="javascript">
    	function moveWindow(AnchorName){window.location.hash=AnchorName;}
    </script>
    I would have figured this out before I posted here if I had remembered I had some php conditions surrounding the javascript that was preventing my tests from being executed.... like I said, an idiot. hahaha

    Anyhooo... have a nice day!


  •  

    Posting Permissions

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