Forum Moderators: open

Message Too Old, No Replies

automatic lines display code

without refresh

         

txbakers

2:06 am on Feb 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a little challenge I need some ideas for. A screen has a drop down box of events, the second character of the code is the number of players:
102 - solo
113 - solo
122 - two players
134 - three players, etc.

When the user selects an entry, I need to display that number of lines for name input:

Name: <input> Age: <input>

I can do it with a refresh of the screen, but I don't want to do that. It should be seamless.

I know the code to write the javascript:


for (var i = 0; i < String(document.formSel.evt.value).substr(1,1); i++){
document.write("Name <input type=text class=inputbox size=20 name=names>&nbsp;Grade <input type=text name=grade size=3 class=inputbox><br>");
}

but I need to figure out how to write it with an onChange event from the drop down box.

I already do similar things with divs and show/hide, but this is different. I want to dynamically create the needed number of lines.

I tried creating a function, but I don't know how I would send the resulting function output to the proper spot on the page.

Any ideas?

Purple Martin

10:37 pm on Feb 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



send the resulting function output to the proper spot on the page

Use innerHTML to write the contents of a div or span. You can write the entire form this way if you like.

txbakers

11:45 pm on Feb 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, forgot about innerHTML. Will give that a try.