This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Pass xml values to a javascript function


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@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Chris Bayes
Sent: Friday, September 07, 2001 10:58 PM
To: xsl-list@lists.mulberrytech.com
Subject: RE: [xsl] 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@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of Chen Wang
> Sent: 08 September 2001 06:38
> To: XSL-List@lists.mulberrytech.com
> Subject: [xsl] 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]