Current location: Hot Scripts Forums » General Web Coding » JavaScript » how to clear a textarea in Netscape/Mozilla


how to clear a textarea in Netscape/Mozilla

Reply
  #1 (permalink)  
Old 03-05-04, 10:09 AM
paulwynd's Avatar
paulwynd paulwynd is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Question how to clear a textarea in Netscape/Mozilla

Greets..

I need to clear text (reset) in a TEXTAREA in my page.

No problem on IE5+:

var textarea=getElementById(id_textarea);
textarea.innerHTML="";


BUT this doesn't work on Mozilla 1.6 (latest version)
Does anybody know why?

Thanks
Reply With Quote
  #2 (permalink)  
Old 03-05-04, 10:32 AM
dcooldude_1's Avatar
dcooldude_1 dcooldude_1 is offline
Newbie Coder
 
Join Date: Feb 2004
Location: Sidney
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
try something like

document.SomeForm.textbox.value = "";

inside of whatever function you have

if this doesn't work let me know
__________________
===================================
Dcooldude_1

Site 1: http://ih.sidneyps.com/hs/spokesman/
Site 2: http://www.webhex.net/

Go to http://www.chatzy.com/?132627185966 this is my chat area...
the password is: progtalk
===================================
Reply With Quote
  #3 (permalink)  
Old 03-08-04, 08:10 AM
paulwynd's Avatar
paulwynd paulwynd is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
hi dcooldude_1,

your code is correct (no errors), but doesn't work on Mozilla...


Quote:
Originally Posted by dcooldude_1
try something like

document.SomeForm.textbox.value = "";

inside of whatever function you have

if this doesn't work let me know
Reply With Quote
  #4 (permalink)  
Old 03-08-04, 10:01 AM
dcooldude_1's Avatar
dcooldude_1 dcooldude_1 is offline
Newbie Coder
 
Join Date: Feb 2004
Location: Sidney
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Well, give me a couple days to figure it out.... Then, I will let you know how to fix your problem......

Sorry my fix didn't work for you...


But, out of curiosity, did it work on Netscape?
__________________
===================================
Dcooldude_1

Site 1: http://ih.sidneyps.com/hs/spokesman/
Site 2: http://www.webhex.net/

Go to http://www.chatzy.com/?132627185966 this is my chat area...
the password is: progtalk
===================================
Reply With Quote
  #5 (permalink)  
Old 03-09-04, 05:40 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
obect references are tricky sometimes so you might have to try several different approaches to find one that works. try adding a browser check if you can't find a way that works for both browsers. Also make sure you don't leave out the <form> tag, that works fine in IE but NE hates messy code...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdown lists determines textarea content mdhall PHP 1 02-08-04 09:46 PM
How to clear the screen? freak Perl 0 01-29-04 08:27 PM
komma in textarea is changed to carriage return chri HTML/XHTML/XML 2 12-22-03 02:51 AM
entering info in textarea Gordon Freeman JavaScript 0 11-03-03 03:00 PM
print textarea prenaud JavaScript 2 08-29-03 08:13 PM


All times are GMT -5. The time now is 02:13 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.