473,400 Members | 2,163 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

Javascript Syntax

This thread is for all people (n00bs and oldies alike) who need some help with there JavaScript syntax.
Aug 9 '07 #1
8 1239
I need help finding the place to put
Expand|Select|Wrap|Line Numbers
  1. form.textarea.value = "Text goes here";
  2.  
in my html document with the following text box.
Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD>
  3. <TITLE>Text Area Test</TITLE>
  4. <SCRIPT LANGUAGE="JavaScript">
  5. function seeTextArea (form) {
  6.     alert (form.myarea.value);
  7. }   
  8. </SCRIPT>
  9. </HEAD>
  10. <BODY>
  11.  
  12. <FORM NAME="myform">
  13. <INPUT TYPE="button" NAME="button3" Value="Test" 
  14.     onClick="seeTextArea(this.form)">
  15. <TEXTAREA NAME="myarea" COLS="40" ROWS="5">
  16. </TEXTAREA>
  17. </FORM>
  18. </BODY>
  19. </HTML>
  20.  
  21.  
Aug 9 '07 #2
pbmods
5,821 Expert 4TB
Heya, fashizzlepop. Welcome to TSDN!

Good luck. Most people don't bother checking to see if their question has already been answered... or even if there's a better place to put their question!

But we're happy to help you out with your issue :)

The correct syntax for your setup would be:
Expand|Select|Wrap|Line Numbers
  1. document.forms[0].myarea.value = "Text goes here";
  2.  
But it would probably be easier if you just did this:
Expand|Select|Wrap|Line Numbers
  1. <textarea name="myarea" cols="40" rows="5">Text goes here</textarea>
  2.  
Aug 9 '07 #3
Hey thanks but I think I allready knew that. I knew about the
Expand|Select|Wrap|Line Numbers
  1. document.forms[0].myarea.value = "Text goes here";
but the question I couldnt figure out is exactly where in the html source do i put that. I've tried many places but it doesn't seem to fit anywhere. If you coulld help me out on that I would greatly appreciate it. I got that original 'test' html from JavaWorld.com because Im trying to learn somemore javascript but it doesn't say where in the source to put the
"document.forms[0].myarea.value = "Text goes here";"
thingy. I know about the other way to but I'd rather learn this for more syntax errors I might come across in the future. Thanks for your help!

PS I hope that this thread is going to be useful to other people to I didn't see one like this for syntax help!
Aug 10 '07 #4
pbmods
5,821 Expert 4TB
Heya, fashizzlepop.

That code would go inside of a script tag sometime after the textarea in question gets created.

For example:
Expand|Select|Wrap|Line Numbers
  1. <textarea name="myArea" ... ></textarea>
  2. <script type="text/javascript">
  3.     // <![CDATA[
  4.     document.forms[0].myArea.value = "Text Goes Here.";
  5.     // ]]>
  6. </script>
  7.  
Aug 10 '07 #5
Thanks alot. Now I get it.
Aug 10 '07 #6
pbmods
5,821 Expert 4TB
Heya, fashizzlepop.

Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Aug 10 '07 #7
kulali
4
This thread is for all people (n00bs and oldies alike) who need some help with there JavaScript syntax.
hai i have the following code
Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD>
  3. </HEAD>
  4. <BODY>
  5. <select name="xxx">
  6. <option>After<option>
  7. <option>Within<option>
  8. <option>Bseetween<option>
  9. </select >
  10. </BODY>
  11. </HTML>
for this if I select "After" then a textbox along with image should displayed in the same page, then if i select "Within" then page should remain same then if I opt for "Between" then it should display two textbox with two images..this all in same page that to using JS.
Aug 11 '07 #8
pbmods
5,821 Expert 4TB
Don't know how I missed it, but moved from the Articles section into the Forum.
Aug 17 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: news frontiernet.net | last post by:
I have key entered and tried to run example 4-6 from Dany Goodmans DYNAMIC HTML book, version one that is on pages 94-96. This is part of my effort to learn JavaScript. I checked each byte and...
9
by: Behzad | last post by:
Hi All. I have a function with javascript is used in my ASP web Page.Now i want to write an application with VB6 same as my asp page and i need to use that javascript function.Can i insert this...
6
by: Andy Fish | last post by:
Hi, I want to use an anchor tag to invoke some javascript and I've read that it's bad form to use <a href="javascript:foo()"> I've read endless usenet posts and hint sites on the net, they all...
6
by: Alex Fitzpatrick | last post by:
Just by way of introduction, I'm currently the principal developer and maintainer of the a JavaScript editor plug-in for Eclipse. https://sourceforge.net/projects/jseditor/ The plug-in as it...
7
by: Matthew | last post by:
I am very new to JavaScript, and have been using Notepad. Is there a editor out there that showes the JavaScript environment variables? Example: I just found out about the document.forms array...
5
by: Jozef | last post by:
Hello, I have done a little "old" ASP work along with some javascript. I'm currently getting into ASP.net and would like to step up my game overall with regard to Web Development. I was...
3
by: Rob R. Ainscough | last post by:
What sick saddistic person came up with the JavaScript language syntax? And was it the same person (or group of people) that came up with the HTML syntax?? OMG, has no one noticed this hopeless...
3
by: dshan | last post by:
Hi all, I can't find an answer to my quesiton anywhere. Given a drop-down list with USA states and other text fields I pass this information for further processing via PHP. If any of the...
18
by: Andrew Wan | last post by:
I have been developing web applications with ASP & Javascript for a long time. I have been using Visual Studio 2003.NET. While VS2003 is okay for intellisense of ASP & Javascript, it's still not...
34
by: dhtml | last post by:
I made a change to the FAQ of javascript to EcmaScript. I got some feedback that the newsgroup is CLJ and the language is commonly referred to as JavaScript. Therefore, the word in the FAQ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.