I have this JavaScript that creates a heirarchial menu and another that will get the current URL of a page that someone is on. I need to know how to run a javascript function and return a value back to my html. Is this possible? Thanks, Jeremy
Printable View
I have this JavaScript that creates a heirarchial menu and another that will get the current URL of a page that someone is on. I need to know how to run a javascript function and return a value back to my html. Is this possible? Thanks, Jeremy
I'm not really sure what you mean, something like this?
If that's not what you meant you'll have to be more specific.Code:<script type="text/javascript"><!--
function funcName() {
//Blah blah
return "return value!";
}
//--></script>
<a href="#" onclick="var returnVal = funcName(); alert(returnVal);">Click</a>
I think that will work. Right now I have this to return the URL of the page the client is on:
I need to be able to call that from HTML and have it return a value. So if you way will work, perfect. I have to work on it a bit. Thanks, JeremyCode:function getURL()
{
var CurURL = location.href
alert(CurURL)
}