PDA

View Full Version : Want to pass Query String to HREF - javascript function


ghurteau
10-05-2005, 06:41 PM
I'm new at playing with html and javascript. I've a script that I want to use to call up and html file, and in this script I want to use a query string to pass info to the html file. The script contains:

iexplore.exe file:Q:/dms2004-sp2/2004/dms/bin/autologin.html?partnumber=$1

Note $1 gets resolved with a 'real' value withing the script before it gets passed to the html. The html below has a href javascript function autologin, which I am trying to pass the 'partnumber' to, but it is taken literally.
How do I code the line <a href="JavaScript:autoLogin('partnumber}')">Log me automatically in</a>, so that partnumber from the query string gets passed into the autologin function?

<html>
<head>

<script type="text/javascript">

function autoLogin(pn) {
document.frmFTZ.submit();
window.open("http://www.partminer.com/servlet/DesignCenter?partnumber=" + pn ,"remote"); }
</script>
</head>


<a href="JavaScript:autoLogin('partnumber}')">Log me automatically in</a>

<body>

<form name="frmFTZ" method=post action="http://www.partminer.com/servlet/Login">
<input type=hidden id=UserName name="txtemailaddress" value="*******@*******"></input>
<input type=hidden id=Password name="txtpassword" value="********"></input>
</form>

</body>
</html>

ghurteau
10-06-2005, 03:54 PM
Sorry guys, posted this to the wrong category