日期:2014-05-16  浏览次数:20618 次

XSL文档有一个input文本框,后面跟一个提交js按钮,怎样判断文本框内容跟上次的是否相同?
第一次加载XML时,给文本框内容一个初始化值,更改文本内容后点击提交按钮,Onclick函数可用getElementById获取到更改后内容,但是怎样保存上一次的值呢?

A.XML

<?xml version="1.0" encoding="gb2312" ?> 
<?xml-stylesheet type = "text/xsl" href = "A.xsl"?>
<bookstore>
<book category="children">
  <title lang="en">Harry Potter</title> 
  <author>  J K. Rowling</author> 
  </book>
</bookstore>


A.XSL如下:

<?xml version = "1.0" encoding = "gb2312"?>
<xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">

<xsl:template name = "HTML_HEAD">
  <script type = "text/javascript" language = "javascript" src = "A.js">
    var globar_str = new String("初始化值");
    <![CDATA[
       function OnInitialize1()
      {
        document.getElementsById('text-str').value =globar_str;
      }
  ]]>
</script>
</xsl:template>

</xsl:template>
    <xsl:template match = "bookstore" name ="MLIST2">
    <script type = "text/javascript" language = "javascript" src = "A.js">
    </script>

    <form id = "form1" name = "form1"  target = "_self" onsubmit = "return OnSubmitApply(this);" method = "post">
            <table id = "table1" class = "content_body_area" border = "0" cellpaddng = "0" cellspacing = "0">
                    <tr class = "row135">  
                        <td class = "content_value">
                            <input type="text" class="textbox" id="texs-tr"/>                              
                         </td>
                    </tr>
            </table>

            <table width="100%" border = "0" cellpaddng = "0" cellspacing = "0" class = "content_set" >
                 <input name="Appl