xml xsl js 怎样改变文本框内容?

xdh0817 2013-04-26 04:04:49
A.xml
<?xml version="1.0" encoding="gb2312" ?> 
<?xml-stylesheet type = "text/xsl" href = "A.xsl"?>
<bookstore>
<td> hello </td>
</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">
</script>
</xsl:template>
<xsl:template match = "/">
<xsl:param name = "sre_res"/>
<table id = "table1" class = "content_body_area" border = "0" cellpaddng = "0" cellspacing = "0">
<tr class = "row135">
<td class = "content_item" widths = "25%">
</td>


<td class = "content_value">
<input type = "text" class = "textbox" id = "text-aging-time1" style = "width:400" value = "hello">

</input>
</td>
<td class = "content_value">
<input type = "text" class = "textbox" id = "text-aging-time2" style = "width:400" value = "jack">

</input>
</td>

</tr>
</table>

<table width="100%" border = "0" cellpaddng = "0" cellspacing = "0" class = "content_set" >
<tr class = "row246">
<td class = "content_item" widths = "25%">
<span> <xsl:value-of select = "/book/year"/> </span>
</td>
<td colspan = "2" align = "center" class = "content_operation_area">
<input name ="ApplyButton" value = "提交" id = "ApplyButton" type = "submit" class = "buttonX" onclick = "changeText()"/>

</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>


A.JS

function changeText()
{
var m = "5";
document.getElementById("text-aging-time1").value = m;
}



目的很简单:用IE打开A.xml出现两个文本框和一个按钮,点击按钮可以改变文本框的内容。
现在的问题:内容无法改变
我是新手,请各位大神解释一下怎么才能实现?
...全文
100 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xdh0817 2013-04-27
  • 打赏
  • 举报
回复
引用 2 楼 showbo 的回复:
js没有倒入吧。。 xsl改成这样 <?xml version = "1.0" encoding = "gb2312"?> <xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "/"> <xsl:param name = "sre_res"/><script type = "text/javascript" language = "javascript" src = "A.js"> </script> <table id = "table1" class = "content_body_area" border = "0" cellpaddng = "0" cellspacing = "0"> <tr class = "row135"> <td class = "content_item" widths = "25%"> </td> <td class = "content_value"> <input type = "text" class = "textbox" id = "text-aging-time1" style = "width:400" value = "hello"> </input> </td> <td class = "content_value"> <input type = "text" class = "textbox" id = "text-aging-time2" style = "width:400" value = "jack"> </input> </td> </tr> </table> <table width="100%" border = "0" cellpaddng = "0" cellspacing = "0" class = "content_set" > <tr class = "row246"> <td class = "content_item" widths = "25%"> <span> <xsl:value-of select = "/book/year"/> </span> </td> <td colspan = "2" align = "center" class = "content_operation_area"> <input name ="ApplyButton" value = "提交" id = "ApplyButton" type = "submit" class = "buttonX" onclick = "changeText()"/> </td> </tr> </table> </xsl:template> </xsl:stylesheet>
本来打算睡觉了,来看看,结果。。。哈哈 谢谢斑竹帮我编辑帖子,并且给我找出了问题所在~ 研究了一天了,原来没有导入js!!!!! 以后有问题还请帮主多多指教~~
Go 旅城通票 2013-04-26
  • 打赏
  • 举报
回复
js没有倒入吧。。 xsl改成这样 <?xml version = "1.0" encoding = "gb2312"?> <xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "/"> <xsl:param name = "sre_res"/><script type = "text/javascript" language = "javascript" src = "A.js"> </script> <table id = "table1" class = "content_body_area" border = "0" cellpaddng = "0" cellspacing = "0"> <tr class = "row135"> <td class = "content_item" widths = "25%"> </td> <td class = "content_value"> <input type = "text" class = "textbox" id = "text-aging-time1" style = "width:400" value = "hello"> </input> </td> <td class = "content_value"> <input type = "text" class = "textbox" id = "text-aging-time2" style = "width:400" value = "jack"> </input> </td> </tr> </table> <table width="100%" border = "0" cellpaddng = "0" cellspacing = "0" class = "content_set" > <tr class = "row246"> <td class = "content_item" widths = "25%"> <span> <xsl:value-of select = "/book/year"/> </span> </td> <td colspan = "2" align = "center" class = "content_operation_area"> <input name ="ApplyButton" value = "提交" id = "ApplyButton" type = "submit" class = "buttonX" onclick = "changeText()"/> </td> </tr> </table> </xsl:template> </xsl:stylesheet>
xdh0817 2013-04-26
  • 打赏
  • 举报
回复

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧