[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Pass xml values to a javascript function

Subject: RE: Pass xml values to a javascript function
From: "Chen Wang" <wangchen01@xxxxxxxxx>
Date: Sat, 8 Sep 2001 10:28:05 -0700
javascript xml values
Hi, Ciao,

I tried, but it did not work.  If I put a specific id in the following
toggle function, it works, that means, I correctly make the attribution to
the paragraph, but the code that you provide can not pass the value from xml
<id> element.  Here is the complete toggle code:
<script language="javascript">

 function WM_toggle(id){

   if (document.all){
     if(document.all[id].style.display == 'none'){
       document.all[id].style.display = 'block';
     } else {
      document.all[id].style.display = 'none';
    }
  } else if (document.getElementById){
    if(document.getElementById(id).style.display == 'none'){
      document.getElementById(id).style.display = 'block';
    } else {
      document.getElementById(id).style.display = 'none';
    }
  }
}
</script>

After I added your code, the page generate the following error:
Line:19
Character:6
Error:'docoment.all[...].style' is null or not an object.  Please help me on
this...chen

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Chris Bayes
Sent: Friday, September 07, 2001 10:58 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Pass xml values to a javascript function


Chen,
<a href="#" onclick="toggle('{id}')><xsl:value-of
select="paragraphname"></a>

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Chen Wang
> Sent: 08 September 2001 06:38
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Pass xml values to a javascript function
>
>
> In xsl file, there is a javascript,
> function toggle(id) {
>    codes here
>   }
> which is used to change the display status of a
> paragraph.  A link will be used to invoke the
> function, like this:
> <a href="#"
> onclick="toggle('a_paragraph_id')><xsl:value-of
> select="paragraphname"></a>
>
> And here is the paragraph should be changed:
> <p style="display:none"><xsl:attribute
> name="id"><xsl:value-of
> select="paragraphid"/></xsl:attribute>paragraph
> here</p>
>
> As you may know, in xml there is an element like this:
> <paragraphid>idnumer</paragraphid>.  My question is: how to
> pass idnumber to 'a_paragraph_id'.
>
> The idea for this xsl is to generate a list of links
> based on the paragraphs in a xml.  And each link can
> toggle the correspondent paragraph.  Thanks,...chen
>
> __________________________________________________
> Do You Yahoo!?
> Get email alerts & NEW webcam video instant messaging with
> Yahoo! Messenger http://im.yahoo.com
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.