• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

asp + dom + html help

i've never used asp before (i'm a java programmer). i am working on a web form that posts information to itself and i want to call a dom method (document.getelementsbyname()) within the asp code, but i always get an error. using just javascript or vbscript i can do it fine.

i have a form input text named mytext and i want to set the value of that text to be what was submitted by the user

i have it working right now where i just have the line where i write the html output from asp and i just put the value attrib of the input to be the value, but i wanted to use dom to do it. i can do the same thing from vbscript or javascript. but when i try to insert the same code into the asp fragment it gives an error. is this possible? is there another way i should/could be doing this.

thank you to anyone for helping out here
 
JavaScript and VBScript are client-side languages, while ASP is a server-side language. Your ASP cannot manipulate the DOM, because the DOM isn't created until the ASP has finished executing and the resulting HTML is delivered to the browser. The browser builds the DOM from the HTML it receives, and it's script engine has access to those DOM objects.

You can still accomplish what you're describing. In your ASP, you probably have:

<input type="text" name="mytext" value="">

You can change it to this:

<input type="text" name="mytext" value='<%=Request.Form("mytext") %>'>

to set it to the value submitted by the user (assuming that this is a postback page and Request.Form("mytext") contains the value you're looking for).
 
Originally posted by: MrChad
JavaScript and VBScript are client-side languages, while ASP is a server-side language. Your ASP cannot manipulate the DOM, because the DOM isn't created until the ASP has finished executing and the resulting HTML is delivered to the browser. The browser builds the DOM from the HTML it receives, and it's script engine has access to those DOM objects.

You can still accomplish what you're describing. In your ASP, you probably have:

<input type="text" name="mytext" value="">

You can change it to this:

<input type="text" name="mytext" value='<%=Request.Form("mytext") %>'>

to set it to the value submitted by the user (assuming that this is a postback page and Request.Form("mytext") contains the value you're looking for).

yeah, that's what i'm doing now. it just seemed like there would be a bette way to do that.
 
Back
Top