Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 27th, 2004, 09:11 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: Whitstable, , United Kingdom.
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting HTML element text using id


Hi,

  i'm very new to JavaScript so dumb questions follow...

  1. is JSP and JScript and JavaScript all the same thing ?

  2. I have assigned a unique id to an HTML textarea.
     I then pass this id into a JavaScript function.
     I want to get the text from the textarea. I have tried
     using getElementById by it doesn't seem to work.

     Eg

     In an HTML page

     <SCRIPT>
     function GetElement(id){
       var oElement;
       var sString;

       oElement = getElementById(id);
       sString = oElement.Text;
     }

My aim to set sString to the text contained within the element
that has the id = 'id'. (In my case the element is a text area).
I cant find an example in my book.
Any syntax help please.
TIA.





Reply With Quote
  #2 (permalink)  
Old July 27th, 2004, 12:17 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

JavaScript was created by sun, JScript is similar to JavaScript created by Microsoft, JSP is server-based, which means Java Server Pages.

You can get the element via document.getElementById(ID), and for a textarea, you may need to use innerText, or value. I'm not sure.

Brian
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
remove duplicate text in an output html element mrame XSLT 1 June 20th, 2008 01:41 AM
html table row id myself.panku ASP.NET 1.x and 2.0 Application Design 0 April 17th, 2008 01:56 PM
value-of within the HTML element attribute BrendonMelville XSLT 1 March 14th, 2006 11:32 AM
html control with same id and name ??? muklee Javascript 1 October 22nd, 2004 12:49 AM



All times are GMT -4. The time now is 01:50 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.