Click to See Complete Forum and Search --> : Help Debug...


Soti
12-02-2002, 07:52 PM
I'm pretty sure it's this line, can anyone tell me what I'm doing wrong:

<a href="https://tester.test.com/testPubView01?source=+strSvr+">

Here is the rest of the script, if you need to see it:

<script>
function getNvp(strKey) {
strVal = window.location.search.substr(1);
if(strVal.indexOf(strKey) >= 0)
{
strVal = strVal.substr(strVal.indexOf(strKey) + strKey.length);
// Check for & or +
if(strVal.indexOf("&") >= 0)
{
strVal = strVal.substr(0, strVal.indexOf("&"));
}
else if(strVal.indexOf("+") >= 0)
{
strVal = strVal.substr(0, strVal.indexOf("+"));
}
}
else
{
strVal = "";
}

return strVal;
}

// Get the server name
strSvr = getNvp("source=");

strUrl = "<a href=http://test.com?source="; + strSvr+"><font
color=#cc0000><b>pre-application approval</b></font></a>";
document.write (strUrl)
</script>

Any ideas?

gil davis
12-03-2002, 05:27 AM
Try:

strUrl = "<a href=http://test.com?source=" + strSvr + "><font
color=#cc0000><b>pre-application approval</b></font></a>";

Soti
12-03-2002, 08:54 AM
This still isn't working right, Is the <a href> tag in the body correct?

<a href="https://tester.test.com/testPubView01?source=+strSvr+">

gil davis
12-03-2002, 10:30 AM
There is nothing wrong with it from a HTML syntax standpoint. I doubt it will do what you want, though. If "strSvr" is a variable that contains some string that you want to pass to the page called "testPubView01", then you've got it all wrong, and I already answered that question.

If you expect the link to pass the current value of "strSvr" to the page, it won't do that. Once you document.write(), the variable becomes static data.