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!

Access Form by Elements

Status
Not open for further replies.

jonthequik

Programmer
Aug 6, 2000
40
0
0
US
I've got an ASP.NET 2.0 Page written in VBScript. In the script, I ask the user to enter a number of weeks and based on that number, I print a form element for each week. There is one box that the user is allowed to modify in the new form. To create the dynamic form, I do a loop and post to a Span.InnerHTML the html code for the form and add i to the end of the ID tag. I know you can access by Elements in Javascript and am trying to figure out how to do so in VBScript

...
For i=1 to intWeeks
aRank = Int((aRating/5000)+2)
aNext = (aRank-1)*5000
aDiff = (aNext-aRating)
aEarned = "13000"
aDecay1 = aRating/5
aDecay = Format$(aDecay1, "0")
aNeed = aDiff+aDecay
aNew = (aEarned-aDecay)+aRating
strHolder2 = strHolder2 & "<tr><td><Span id=spanRank" & i & " >" & aRank & "</Span></td><td><Span id=spanRating" & i & " >" & aRating & "</td><td><Span id=spanDecay" & i & " >" & aDecay & "</td><td><Span id=spanNext" & i & " >" & aNext & "</td><td><Span id=spanDiff" & i & " >" & aDiff & "</td><td><Span id=spanNeed" & i & " >" & aNeed & "</td><td><input type=text runat=server id=txtEarned" & i & " size=5 AutoPostBack=True OnTextChange=Get_Forecast value=" & aEarned & "></td><td><Span id=spanNew" & i & " >" & aNew & "</td></tr>"

aRating = aNew

Next

Once this script is posted, if they change the value in txtEarned1, txtEarned2, etc, it will postback to another subroutine to refigure the data printed.

P.S. Excuse the sloppy code, I'm about 2 weeks into VBScript/ASP


Jonathan Hannan
Computer Repair, Webdesign
HTML, CGI, PERL, JavaScript, XML
 
>I know you can access by Elements in Javascript and am trying to figure out how to do so in VBScript
Not much difference.
[tt] s=document.getElementById("txtEarned" & i).value 'for varying i, for instance[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top