我有一个HTML输入文本框,我试图将它的值传递给JavaScript函数.文本框的代码如下;
<input type="text" id="fname">
<input type="button" onclick="success()">
Run Code Online (Sandbox Code Playgroud)
我用它来获取文本框的值;
var depttxt = document.getElementsByID('fname');
Run Code Online (Sandbox Code Playgroud)
但是当我试图找到这样的值的值时;
function success() {
alert(depttxt);
}
Run Code Online (Sandbox Code Playgroud)
警报框说undefined.如果然后将其放在.value警报中的变量之后,则会中断,并且不会显示任何警告框.谁能告诉我这里我做错了什么?
谢谢大家!
我的XSLT转换有点问题.
我有以下XSLT;
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><!-- removes the unrelated elements -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="master_version[not(ORDER = //order/ORDERPK)]"/>
<xsl:template match="press_section[not(ORDER = //order/ORDERPK)]"/>
<xsl:template match="version[not(ORDER = //order/ORDERPK)]"/>
<xsl:template match="task_info_press_section[not(ORDER = //order/ORDERPK)]"/>
<xsl:template match="task_info_post_press[not(ORDER = //order/ORDERPK)]"/>
<xsl:template match="post_press_version[not(ORDER = //order/ORDERPK)]"/>
<!-- removes specified nodes from all elements -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="ORDER"/>
<xsl:template match="ORDERPK"/>
<xsl:template match="PRESS_x0020_SECTION"/>
<xsl:template match="POST_x0020_PRESS"/>
<!-- Creates attributes against the ORDER element -->
<xsl:strip-space …Run Code Online (Sandbox Code Playgroud)