开发者

Javascript displays more text boxes depending on a pull down option?

I don't know if this is possible in Javascript but I am trying to achieve this. I don't know the terminology so I thought I would post it on here with pseudo code to help you understand what I want to implement.

Pseudo Code:

  • User Selects Option from pull down.
  • If selection matc开发者_如何学编程hes criteria
  • Add text boxes to the form
  • Else if selection is something else
  • Add invisible text box with NULL value

I would like to code it myself but if you could post some reference material or links as I have not done much with Javascript.

Thanks


For your first and second entries, google for 'html select onchange'.

You'll want to check out document.createElement for "Add text boxes to the form"

To make your text box invisible, check out the CSS display property, setting it to none or block (or inline)

I've tried to keep this answer very short without code samples because it sounds like you want to do it yourself. Add a comment to my answer if you want more of an example.

EDIT

Also of note, along with document.createElement, you will want to look at appendChild to add the created element to an HTML element, most likely some FORM element in your page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜