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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing ASP variables to Javascript

Status
Not open for further replies.

Gmon

IS-IT--Management
Mar 18, 2001
14
0
0
US
I am capturing the NT login with the Request.ServerVariables method. I then need to pass it to Javascript to place a cookie. What is the best way to do this?

Thanks.
 
<script>
var x = &quot;<%=Request.ServerVariables()%>&quot; luciddream@subdimension.com
 
Code:
<html>
<head>
<script Language=&quot;JavaScript&quot;>
<!--
function somefunction() {
     var jslogin
     jslogin = &quot;<%=Request.ServerVariables(&quot;SOME_KEY&quot;)%>&quot;
}
//-->
</script>
</head>

<body>
Web Page Content
</body>
</html>

Have Fun

ToddWW
 
Thanks for your prompt reply guy's.
For clarification on my part, I have captured the login to a variable called UserLogin in the VB routine below.

<%
'Get the NT login name
UserLogin=Request.ServerVariables(&quot;AUTH_USER&quot;)
%>

Now, in the JavaScript routine below, what would go between the ()in the ServerVariables method? Can I just capture the AUTH_USER directly from the routine below.

<script>
UserLogin = &quot;<%=Request.ServerVariables()%>&quot;
</script>


Thanks for you help.
Gmon.
 
you just use the VBScript variable... all you need to do is print the string to the document...

<script>
UserLogin = &quot;<%=UserLogin%>&quot;
</script>
luciddream@subdimension.com
 
Great! Thanks for you help!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top