We help IT Professionals succeed at work.

javascript open link with variables

Luey
Luey used Ask the Experts™
on
Hello what is wrong with my javascript.  It opens the url correctly except for it adding [objectHTMLInputElement] in the url.  This is the url the code is opening.
http://www.accesswestga.com/[objectHTMLInputElement]dealer_real_estate_my_account.php?agent=24&show=HOME
<script type="text/javascript">
function openLink(){
	location = document.getElementById('site_url') + "dealer_real_estate_my_account.php?agent=" + document.getElementById('link_agent').value + "&show=" + document.getElementById('link_property').value;
}
</script>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
It is caused by this

document.getElementById('site_url')

it looks like it is missing its '.value' like so

document.getElementById('site_url').value

Author

Commented:
Uh Duh! Thanks for the good set of eyes.  I guess mine are getting to old for this.
These things are easily missed.

I once spent an hour trying to figure out why changes to a script had no apparent effect. The script I was editing was on my test server. The script I was testing was on the LIVE server.

Duh!!!

Author

Commented:
I hear ya! Thanks again