Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

contents of textbox erased after tabbing to next textbox

Status
Not open for further replies.

varocho

Programmer
Dec 4, 2000
238
US
I have several data entry pages in my Web application, and they have textboxes that need to appear when their labels are clicked, and disappear when their labels are double-clicked. I'm using JavaScript to make this happen, but for some reason, the only way I can enter any text into a textbox is if I keep the mouse-button pressed down within the textbox while I'm entering something. (I'm seeing this w/both IE and Firefox). But when I tab to the next textbox, what I entered in the previous textbox disappears.

Any ideas as to how to fix this?
 
Hi Dan,

Thanks for taking the time to respond. Here's some code:

document.getElementById("div" + className).innerHTML = newClassName + "<br><input type='text' name='txt" + className + "' onBlur='javascript:updateDOM(this);' />" + label;

(The code for the 'updateDOM' method can be found here:


)
 
How about a URL to your page, not code on a third-party site that doesn't have much to do with showing / hiding inputs cross-browser?

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Here it is, but for some reason the property labels don't appear after you click on the 'Environment' image, so you'll need to click within the column to the right of the image to get the property labels and textboxes to appear (tripod.com seems to add some of their own JavaScript code to an uploaded page):

 
JavaScript code to display the property name, textbox and label:

document.getElementById("div" + className).innerHTML = newClassName + "<br><input type='text' name='txt" + className + "' onBlur='javascript:updateDOM(this);' />" + label;

JavaScript code to just display the property name:

document.getElementById("div" + className).innerHTML = newClassName;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top