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

Button Click Event

P: n/a
I have two web form buttons and three textboxes.
I would like to hide the textboxes when I click a button.
I wouldl ike to show the textboxes when I click a button.

This is my code so far but it's not working, can someone help me? Thank
you in advance.

mo***@adelphia.net

function hideall() {
var NaTextbox1 = document.getElementById('NaTextbox1')
var NaTextbox2 = document.getElementById('NaTextbox2')
var NaTextbox3 = document.getElementById('NaTextbox3')
changeLabelVisibility(NaTextbox1,'hidden');
changeLabelVisibility(NaTextbox2,'hidden');
changeLabelVisibility(NaTextbox3,'hidden');
}

function displayall() {
var NaTextbox1 = document.getElementById('NaTextbox1')
var NaTextbox2 = document.getElementById('NaTextbox2')
var NaTextbox3 = document.getElementById('NaTextbox3')
changeLabelVisibility(NaTextbox1,'visible');
changeLabelVisibility(NaTextbox2,'visible');
changeLabelVisibility(NaTextbox3,'visible');
}

Dec 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I do have the function changeLabelVisibility(), I just found out that
every web button automatically adds the "Type=Submit" to my buttons and
because of this my buttons are not turned invisible.

I tried the same code with a regular HTML button, without the
"Type=Submit" and it works.

Can you give me some sample code using the Elements collection? I am
new with JavaScript.

Thank you again.

Lee wrote:
mo****@gmail.com said:

I have two web form buttons and three textboxes.
I would like to hide the textboxes when I click a button.
I wouldl ike to show the textboxes when I click a button.

This is my code so far but it's not working, can someone help me? Thank
you in advance.

mo***@adelphia.net

function hideall() {
var NaTextbox1 = document.getElementById('NaTextbox1')
var NaTextbox2 = document.getElementById('NaTextbox2')
var NaTextbox3 = document.getElementById('NaTextbox3')
changeLabelVisibility(NaTextbox1,'hidden');
changeLabelVisibility(NaTextbox2,'hidden');
changeLabelVisibility(NaTextbox3,'hidden');
}

function displayall() {
var NaTextbox1 = document.getElementById('NaTextbox1')
var NaTextbox2 = document.getElementById('NaTextbox2')
var NaTextbox3 = document.getElementById('NaTextbox3')
changeLabelVisibility(NaTextbox1,'visible');
changeLabelVisibility(NaTextbox2,'visible');
changeLabelVisibility(NaTextbox3,'visible');
}


Do you have a function named changeLabelVisibility() ?
That's not a built-in function.
It's probably over-kill to get the textbox references by Id.
If your buttons are in the same form, you can use the elements
collection.


Dec 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.