...

View Full Version : Resolved Pass Variable and Use in Function



peterallcdn
10-16-2008, 08:29 PM
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)


<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.


<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

peterallcdn
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;}
</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!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum