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 | Calendar | 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 June 28th, 2005, 02:26 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to get the value of pre?

I have a pre tag in the HTML,like follows:
<form name='myform'>
<pre id='a' style="margin:0px;">
12345 912345 12345
</pre>

<script language="JavaScript" type="text/JavaScript">
alert(document.myform.a.value);
</script>
</form>

I want to get the value of pre tag,is there any method to do it? I use alert sentence to show it,but IE raise an error:
document.myform.a.value is null or not object.

Thanks for any help

Reply With Quote
  #2 (permalink)  
Old June 28th, 2005, 03:27 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Edward,

Try this...
Code:
alert(document.getElementById("a").innerHTML);
HTH,

Chris

Reply With Quote
  #3 (permalink)  
Old June 28th, 2005, 07:38 AM
Authorized User
 
Join Date: Feb 2005
Location: Havana, , Cuba.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to deniscuba
Default

this is the way:

alert(document.getElementById("a").innerText);

Regards.
        Denis


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
CheckBoxList can not be Pre-loaded cJeffreywang ASP.NET 2.0 Basics 1 October 17th, 2008 10:29 AM
Pre-compilation errors CRONER BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 August 6th, 2007 10:15 PM
pre-jit compilers naidu_divi2000 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 July 10th, 2005 11:22 PM
Pre defining of a site. Sibrovvs Dreamweaver (all versions) 3 December 8th, 2004 07:16 AM
pre-processing chenggong Crystal Reports 0 July 21st, 2003 09:34 PM



All times are GMT -4. The time now is 05:58 AM.


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