By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 3,231 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

declaring text box

P: 8
how to declare a textbox in Javascript???
Oct 27 '08 #1
Share this Question
Share on Google+
12 Replies


acoder
Expert Mod 15k+
P: 16,027
Can you be more clear in defining your problem/question? What do you mean by declaring a text box? Do you mean creating one and displaying it?
Oct 27 '08 #2

P: 8
Thank you for ur response. The requirement is like this. i have a java script function 'displayTxtBox()'. i just want pass the text boxes names while calling this function. can you helpme? how can ido that?
Oct 27 '08 #3

gits
Expert Mod 5K+
P: 5,235
i don't understand this ... are the textboxes just hidden or do you need to create them dynamically first? ... the function should just receive the name of the box - what should exactly happen then? please show what you have done so far and give an example for the wished behaviour ...

kind regards
Oct 27 '08 #4

P: 8
the text boxes will be hidden at the page load. in the fuction i have wriiten the code to make it visible. please see the below mail

Expand|Select|Wrap|Line Numbers
  1. function displayCalibTxt()
  2.  {
  3.    document.Form1.TxtCalib1.style.display='block'
  4.    document.Form1.TxtCalib2.style.display='block'
  5. }
so instead of writing the text boxes id one by one. can i pass the text box id as parameter?
Oct 27 '08 #5

P: 8
please let me know if you want it more clear
Oct 27 '08 #6

acoder
Expert Mod 15k+
P: 16,027
so instead of writing the text boxes id one by one. can i pass the text box id as parameter?
Yes, of course.
Expand|Select|Wrap|Line Numbers
  1. function displayTxtBox(id) {
  2.     document.getElementById(id).style.display='block';
  3. }
Remember to make sure the ID is unique.
Oct 27 '08 #7

P: 8
Thank you very much for the prompt help
Oct 27 '08 #8

acoder
Expert Mod 15k+
P: 16,027
No problem. Post again if you have more questions :)
Oct 27 '08 #9

P: 8
Am sorry to bother u guys. i tried to make the function as above. an d i called the function like
<TD onclick="displayText(TxtID)"><INPUT id="TxtID" style="WIDTH: 39px; HEIGHT: 22px" type="text" size="1" name="Txt1></TD>

but i am getting error. can you pls help me.
Nov 2 '08 #10

P: 8
can anyone help me please. please let me know if it wanted to be more clear.
Nov 2 '08 #11

P: 8
Yes. I got it. i misssed quotes while passing the parameter.
Nov 2 '08 #12

acoder
Expert Mod 15k+
P: 16,027
Yes, that's correct. Well done- you managed to solve it yourself.
Nov 2 '08 #13

Post your reply

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