View Full Version : Resolved Pass Variable and Use in Function

10-16-2008, 08:29 PM

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)

<script type="text/javascript" language="javascript">
function moveWindow(AnchorName){window.location.hash='AnchorName';}

This is the call to the function with the dynamic anchor name, and is placed before the </body> tag.

<script type="text/javascript"><!--

How do I correctly pass(or correctly use the passed) the anchor name "comment" to the moveWindow() function?

Thanks for any and all help!


10-16-2008, 08:48 PM
Never mind, I'm an idiot, I got it...

<script type="text/javascript" language="javascript">
function moveWindow(AnchorName){window.location.hash=AnchorName;}

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!