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

variable in the value of an input tag 3

Status
Not open for further replies.

Placido

MIS
Mar 13, 2002
105
0
0
IT
Hi everybody-

I have this tag that works in ASP:

<INPUT type=&quot;hidden&quot; id=&quot;username&quot; size=&quot;12&quot; name=&quot;username&quot; value='<%=Request.QueryString(&quot;user&quot;)%>'>

Can I code in Javascript something similar? Meaning can I replace the vbscript query with javascript code or variable...


Ciao
Placido

P.S.
Knowledge gives you the mean to see the door...
Wisdom gives you the key to open it...
 
server side or client side javascript?

if you want to do javascript on the server via asp then jsut state the language in the start of the page and use javascript in the asp coding.


____________________________________________________
[sub]The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-2924[/sub]
onpnt2.gif
 
Hi onpnt-

it's actually client-side javascript, and I'm trying to fill the value with the network username...

Ciao
Placido

P.S.
Knowledge gives you the mean to see the door...
Wisdom gives you the key to open it...
 
I do not believe javascript is going to be able to give you the network username or any value in to that effect that the server run script can. either which way you're going to need the ASP (or otehr server tech's) intervention to populate the value.

On a different note though. if you are sending a value via the URL (querystring) you can extract taht value with javascript
example found:
You could run a function onload in the page to get that value and populate the text input


____________________________________________________
[sub]The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-2924[/sub]
onpnt2.gif
 
No asp needed...

<script>
function getUser(){
var q=[],p=location.search.substring(1).replace(/\+/g,' ').split(&quot;&&quot;);
for(var i=0;i<p.length;i++){v=p.split(&quot;=&quot;);q[unescape(v[0])]=unescape(v[1])}
document.forms[0].username.value=q[&quot;user&quot;];
}
</script>
<body onload=&quot;getUser()&quot;>
<input type=&quot;hidden&quot; name=&quot;username&quot;>

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

Part and Inventory Search

Sponsor

Back
Top