473,503 Members | 9,887 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

making things dynamic in html form

2 New Member
suppose i have
3 check boxes on a form marked as 1 , 2, 3

now if i click on 1 correspodingly 1 textbox should appear on the same page
and if i click on 2 correspodingly 2 textboxes should appear on the same page
and so on

means if event handling is possible on html tags or not
Dec 16 '06 #1
2 1694
b1randon
171 Recognized Expert New Member
suppose i have
3 check boxes on a form marked as 1 , 2, 3

now if i click on 1 correspodingly 1 textbox should appear on the same page
and if i click on 2 correspodingly 2 textboxes should appear on the same page
and so on

means if event handling is possible on html tags or not
You'll need to tweak this to suit your needs (unless you want them in the getElementsByName array like this, but this should do ya:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script language="JavaScript" type="text/javascript">
  4. function showBox(index)
  5. {
  6.     if (document.getElementsByName('check')[index].checked)
  7.         document.getElementsByName('text')[index].style.visibility = 'visible';
  8.     else
  9.         document.getElementsByName('text')[index].style.visibility = 'hidden';
  10. }
  11. </script>
  12. </head>
  13. <body>
  14. <input type="checkBox" name="check" onclick="showBox(0);" /><input type="text" name="text" style="visibility:hidden;" /><br />
  15. <input type="checkBox" name="check" onclick="showBox(1);" /><input type="text" name="text" style="visibility:hidden;" /><br />
  16. <input type="checkBox" name="check" onclick="showBox(2);" /><input type="text" name="text" style="visibility:hidden;" /><br />
  17. </body>
  18. </html>
  19.  
Dec 18 '06 #2
AricC
1,892 Recognized Expert Top Contributor
Please don't double post.
Dec 19 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
3996
by: Christopher Jeris | last post by:
I am relatively new to JavaScript, though not to programming, and I'm having trouble finding the idiomatic JS solution to the following problem. I have a table with (say) fields f1, f2, f3. I...
6
2904
by: MikeY | last post by:
Hi Everyone, Does anyone know where I can get my hands on a sample with source code of a simple dynamic button control in C# Windows form. I am looking for a sample that uses a class library...
2
12345
by: Michael | last post by:
Need some help trying to read values from web controls - specifically *finding* the controls (like a drop down list) - that are added dynamically added within an asp:panel control. The page...
7
3560
by: Venus | last post by:
Hello, I am trying to generate a dynamic form at runtime and would like to do it using "<asp: ..." form elements as follows Build up the string that is placed somewhere in the HTML code the...
4
3282
by: Venus | last post by:
Hello, Thanks for your reply. I understand that a control can be created dynamically in several ways: 1) using StringBuilder 2) using Controls.Add 3) using ASP PlaceHolder But this is just...
0
1447
by: Venus | last post by:
Hello, After trying some ways to do it I wanted to use something like the code below but for some reason is not working (I have to generate the entire form dynamically (not only the controls)):...
669
25394
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
7
2774
by: extremerep | last post by:
My task is to change the value of a button and then make it functional with the onClick handler. Changing the value to "Play Again" works, but making the onClick work accordingly does not. The...
11
6224
by: Rafe | last post by:
Hi, I'm working within an application (making a lot of wrappers), but the application is not case sensitive. For example, Typing obj.name, obj.Name, or even object.naMe is all fine (as far as...
0
7095
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7294
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7361
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5602
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.