So I have this JavaScript function getSearchVariable which basically acquires a variable from the URL using raw Javascript.
I need to redirect the user to a page with a URL with some static text before the variable and after the variable.
document.location.href="?="+(getSearchVariable('Track')+"&tba=N"
Any idea on why something like the code above won't work?
So I have this JavaScript function getSearchVariable which basically acquires a variable from the URL using raw Javascript.
I need to redirect the user to a page with a URL with some static text before the variable and after the variable.
document.location.href="http://example./tracer?="+(getSearchVariable('Track')+"&tba=N"
Any idea on why something like the code above won't work?
Share Improve this question asked Nov 8, 2012 at 0:39 henryaaronhenryaaron 6,21221 gold badges63 silver badges82 bronze badges2 Answers
Reset to default 3Your parenthesis are not balanced.
document.location.href=
"http://example./tracer?="+(getSearchVariable('Track')+"&tba=N"
// ^
// |
// +--- Remove this guy.
Because you are missing a )
document.location.href="http://example./tracer?="+(getSearchVariable('Track')+"&tba=N"
^1 ^2 ^2
it should be
document.location.href="http://example./tracer?="+(getSearchVariable('Track'))+"&tba=N"
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745635144a4637345.html
评论列表(0条)