SetParameter in JS

Discussion in 'Javascript' started by ignignokt, Feb 4, 2007.

  1. ignignokt

    ignignokt Guest

    I am trying to send a value to a XSL file from a HTML file with
    javascript. How can I get started with this?

    HTML file:
    <html>
    <body>
    <script type="text/javascript">
    function Request(key)
    {
    var strQueryString=QueryString();
    strQueryString=strQueryString.replace(/\%20/g," ");
    if (strQueryString.length < 1)
    return "";

    arrTmp=strQueryString.split("&");
    for (var i=0; i<arrTmp.length; i++)
    {
    var arrTmp2=arrTmp.split("=");
    if (arrTmp2.length < 1)
    continue;
    var curKey=arrTmp2[0];
    var curValue=(arrTmp2.length < 2)?"":arrTmp2[1];
    if (curKey.toLowerCase() == key.toLowerCase())
    return curValue;
    }
    return "";
    }

    function QueryString()
    {
    var strFullUrl=document.location+"";
    var arrTmp=strFullUrl.split("?");
    if (arrTmp.length < 2)
    return "";
    return arrTmp[1];
    }

    alert(Request("disc"));


    </script>
    </body>
    </html>

    XSL:
    <?xml version='1.0' encoding='ISO-8859-1'?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
    Transform">
    <xsl:eek:utput method="html"/>
    <xsl:template match="/">

    <html>
    <body>
    <h2>
    <font face="Arial" size="6">Video Catalog v1.0</font>
    </h2>

    <xsl:for-each select="catalog/disc">
    <table width="100%" border="1">
    <tbody>
    <tr bgColor="#0033ff">
    <td width="100%">
    <font face="Arial" size="5">
    <font color="#ffffff"><strong>Disc - </strong>
    <strong><xsl:value-of select="file/label"/></strong>
    </font>
    </font>
    </td>
    </tr>
    </tbody>
    </table>


    <xsl:for-each select="file">
    <table width="100%" border="1"><tbody>
    <tr bgColor="#00ccff">
    <td><p align="center">
    <font face="Arial" size="4">
    <strong>Filename</strong>
    </font>
    </p>
    </td>
    <td>
    <p align="center">
    <font face="Arial" size="4">
    <strong>Size</strong>
    </font>
    </p>
    </td>

    <td>
    <p align="center">
    <font face="Arial" size="4">
    <strong>Date Created</strong>
    </font>
    </p>
    </td>
    </tr>

    <tr>
    <td>
    <p align="center">
    <font face="Arial">
    <xsl:value-of select="name"/>
    </font>
    </p>
    </td>
    <td>
    <p align="center">
    <font face="Arial">
    <xsl:value-of select="size"/>
    </font>
    </p>
    </td>
    <td>
    <p align="center">
    <font face="Arial">
    <xsl:value-of select="created"/>
    </font>
    </p>
    </td>
    </tr>

    <tr>
    <td><img src="{image01}"/></td>
    <td><img src="{image02}"/></td>
    <td><img src="{image03}"/></td>
    <td><img src="{image04}"/></td>
    <td><img src="{image05}"/></td>
    <td><img src="{image06}"/></td>
    </tr>
    </tbody>
    </table>
    </xsl:for-each>
    </xsl:for-each>


    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
     
    ignignokt, Feb 4, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ebramcity

    setParameter for Applet

    ebramcity, Jul 16, 2005, in forum: Java
    Replies:
    6
    Views:
    4,296
    Roedy Green
    Jul 17, 2005
  2. Piet71
    Replies:
    1
    Views:
    494
    Joe Kesselman
    Mar 7, 2007
Loading...

Share This Page