LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-03-2004, 07:50 AM   #1
aiiiq
LQ Newbie
 
Registered: May 2004
Location: China
Distribution: Knoppix
Posts: 4

Rep: Reputation: 0
Lightbulb how to use JavaScript on Mozilla?


I can run the following code on IE6 or Konqueror normally.
But can not run it on Mozilla, why?


<textarea name=aaa>
abc
</textarea>

<script>
alert(aaa.value)
</script>
 
Old 05-03-2004, 09:02 AM   #2
rkef
Member
 
Registered: Mar 2004
Location: bursa
Posts: 110

Rep: Reputation: 15
The following works:
Code:
<form name="myform">
<textarea name="aaa">
abc
</textarea>
</form>
<script language="javascript">
var alert_msg = document.forms['myform'].elements['aaa'].value;
alert(alert_msg);
</script>
hth
 
Old 05-03-2004, 02:30 PM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
That one works:

<form>
<textarea name="aaa">
abc
</textarea>
</form>

<script>
alert(document.forms[0].elements["aaa"].value)
</script>

PS: Sorry, I didn't refreshed this thread window so I thought I was replying first, the previous code posted is better, actually ...

Last edited by jlliagre; 05-03-2004 at 02:38 PM.
 
Old 05-03-2004, 09:20 PM   #4
aiiiq
LQ Newbie
 
Registered: May 2004
Location: China
Distribution: Knoppix
Posts: 4

Original Poster
Rep: Reputation: 0
<form name='aaaform'>
<textarea id=bbb name=aaa>
Thank you very much!
</textarea>
</form>

<script>
alert(document.getElementById("bbb").value)
alert(document.forms['aaaform'].elements["aaa"].value)
</script>
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mozilla and Javascript redsea Linux - Software 6 04-11-2004 02:14 PM
how to let mozilla execut javascript??? gk_linux Linux - Software 2 11-23-2003 08:32 PM
javascript on mozilla abd_bela Linux - Software 2 07-27-2003 05:43 AM
Mozilla with XML and Javascript zebbedi Linux - Software 2 03-06-2003 10:34 PM
javascript/mozilla wr3ck3d Linux - General 3 12-18-2002 02:13 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration