Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java variable into JavaScript

Status
Not open for further replies.
Remove the single-quotes and commas around the <%=userInfo%>. If you're writing a JSP (or something similar), then <%=userInfo%> is just like typing the value for it right there into the string.

Now, if the value of userInfo was equal to the name of a javascript variable in scope at that moment, then the syntax you are using would put the value of that var there (although, you would still have to convert the commas to plus-signs for proper String concatenation).

'hope that helps.

--Dave
 
That looks like ASP to me, not Java. Try this:

Code:
document.write('<a href="[URL unfurl="true"]http://rscdev:8700/acweb/executereport.do?__executableName=/PNC/CDR_Roxfiles/StandardRpts/CDR_Detail.rox&invokesubmit=true&userID=<%=userInfo%>&password=xxxxxxx&ParamDorH=D"[/URL] target="cdrhome">Current Day Detail</a>');

But I don't see the point in using JavaScript here. Couldn't you do this?
Code:
<a href="[URL unfurl="true"]http://rscdev:8700/acweb/executereport.do?__executableName=/PNC/CDR_Roxfiles/StandardRpts/CDR_Detail.rox&invokesubmit=true&userID=<%=userInfo%>&password=xxxxxxx&ParamDorH=D"[/URL] target="cdrhome">Current Day Detail</a>

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
Thanks for the replies Dave and Adam. I'll give your suggestions a try.
 
FYI, Adam:

I'm checking out Tek-Tips with my right hand and writing JSPs with my left. <%=something%> is the format we use to stick Java values into the pages. I'm not familiar with ASPs (though I wish I were). I imagine it's the same.

--Dave
 
Yeah, I forgot that other languages use that format. You can even configure PHP to look that way too.

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top