Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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

  #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

  #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




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





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