Avatar billede fredand Forsker
15. juni 2001 - 14:46 Der er 6 kommentarer og
4 løsninger

Clear a TextArea in Netsscape 4.7 on Mac

Hola!

I need to clear a textarea.

This works fine...
/********************************************
** CLEAR THE TEXT AREA
*********************************************/
function clearTextArea()
{
document.forms[\"dummy_form\"].text.value = \"\";
//Or this one below
//document.forms[\"dummy_form\"].text.innerText= \"\";
}
...at Pc in both NS and IE

But this doen\'t work on Mac in IE 4.5 and NS 4.7 and NS 4.76

It works on Mac in IE 5.5 and Ns 6.0.

Does any one know how to do this??

Best Regards

Fredrik
Avatar billede spacey Nybegynder
15. juni 2001 - 15:04 #1
document.dummy_form.field_name.value = \"\";

should work on all platforms, from ie 3+ and NS 2+.


Enjoy.

Avatar billede fredand Forsker
15. juni 2001 - 15:24 #2
Hola!

I don\'t get that to work acctually, are you sure this is right:
document.dummy_form.text.value = \"\";

Fredrik
Avatar billede jakoba Nybegynder
15. juni 2001 - 21:24 #3
Your name \"text\" is a rather risky one, better use names vith no particular meaning to programmers :)

function clearTextArea() {
document.forms[\"dummy_form\"].elements[\"text\"].value = \"\";
}

is the safest possible way of adressing a form field.

the other line:
//document.forms[\"dummy_form\"].text.innerText= \"\";

I would not expect that to work i Netscape on either OS.

best JakobA
Avatar billede warpgiga Nybegynder
18. juni 2001 - 02:27 #4
Hi. I have experienced trouble with form names containing underscore characters, try renaming the form to dummyForm instead..
Avatar billede warpgiga Nybegynder
18. juni 2001 - 02:30 #5
also you might want to change the name \"text\" to something more like \"myText\" in order to avoid conflicting with reserved word etc.. i.e:
var document = \"a pretty dumb string to make\";
Avatar billede ldanielsen Nybegynder
18. juni 2001 - 09:35 #6
Also be sure to have the </form> tag placed correctly. IE is not very particular about that, NS is.
Avatar billede jakoba Nybegynder
18. juni 2001 - 12:44 #7
summing up:

på siden http://hjem.get2net.dk/Jakob.Aggernaes/temp/exp81851.html

Har jeg lavet en lille demo det adresserer formefelter på fire forskellige måder. de virker alle i diverse browsere på PC, og jeg ville forvente at de også virkede på mac.

mvh JakobA
Avatar billede ldanielsen Nybegynder
22. juni 2001 - 02:02 #8
The \"problem\" with NS is essentially the same on the Mac as it is on th PC:

It won\'t accept code with errors.

MSIE will. I say that Microsoft are wrong.

Show us some more code, and perhaps we can spot the problem. Start by stripping the page off anything but the essential, and we will get that to work. Then you won\'t have to submit four feet of code.
Avatar billede fredand Forsker
25. juni 2001 - 14:47 #9
Hola!

Now I am trying this:
/********************************************
** CLEAR THE TEXT AREA
*********************************************/
function clearTextArea()
{
    alert(\"clearTextArea\");
    document.forms[\"dummyForm\"].elements[\"dummyText\"].value = \"\";
   
    }

But unfortunately it won\'t work for me in Mac.
Perhaps this is a bug in Mac??

Does anyone se something that might be the error?

Best Regards
Fredrik
Avatar billede fredand Forsker
25. juni 2001 - 15:28 #10
Hello!

Sorry to bother all you guys with this question. I finally recall this html-element:
<input type=\"reset\" value=\"Rensa textfältet\" name=\"clear\">
Sorry again and thanks for all your time!!

Best regards
Fredrik
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester