Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT 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 December 26th, 2006, 06:18 PM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to smi13y
Default xsl javascript problem

Any idea why this script doesn't work?
It should work like this: http://www.ekcsoft.com/coding/js_hideexample.php

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>

<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">

<script><![CDATA[

var hide= true;
    function toggleRows(tableId, tag){

        tbl = document.getElementById(tableId);

        var len = tbl.rows.length;

        var vStyle = (hide)? "none":"";

        for(i=1 ; i < len; i++){
             tbl.rows[i].style.display = vStyle;
        }

        if(hide)
            tag.innerHTML = "<b>Click here to show rows</b>";
        else
            tag.innerHTML = "<b>Click here to hide rows</b>";
        hide= !hide;
    }
]]></script>

<body



Try hiding/showing table rows here:

    <p onClick='toggleRows("myTable", this)' style='cursor:pointer'><b>Click here to hide rows </b></p>

    <table id="myTable" style="width:200px; border: thin solid blue;">
            <tbody>
                <tr>
                    <td>
                        Test cell 1
                    </td>
                    <td>
                       Test cell 2
                    </td>
                </tr>
                <tr>
                        <td>
                            Test cell 3
                        </td>
                        <td>
                           Test cell 4
                        </td>
                </tr>
                <tr>
                        <td>
                            Test cell 5
                        </td>
                        <td>
                           Test cell 6
                        </td>
                </tr>
            </tbody>
        </table>
</body>
</html>
Reply With Quote
  #2 (permalink)  
Old December 26th, 2006, 07:27 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Looks to me like a Javscript question rather than an XSLT question.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
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
Javascript in Xsl using-Xalan-Problem angeshwar XSLT 1 May 7th, 2008 12:36 AM
XSL maybe javascript. suri_1811 XSLT 1 November 3rd, 2006 12:20 PM
Javascript with XSL drdexter33 XSLT 2 January 19th, 2006 01:36 PM
Problem with JavaScript in XSL viachi XSLT 3 August 30th, 2004 09:12 AM
Tricky Javascript/XSL '&' problem...... robster Javascript How-To 1 January 23rd, 2004 02:11 PM



All times are GMT -4. The time now is 09:40 PM.


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