0

我需要帮助。

在 xml 和 WebtextEdit 中没有线索,我正在编辑一个创建 asp 控件的 xslt 样式表。

下面是 WebTextEdit 控件,我想添加一个 mousemove 事件:

   <xsl:element name="igtxt:WebTextEdit">
        <xsl:attribute name='id'><xsl:value-of select='$Name' /></xsl:attribute>
        <xsl:attribute name='runat'>server</xsl:attribute> 
 <xsl:attribute name='Text'><xsl:value-of select='$Value' disable-output-escaping="yes" /></xsl:attribute>                                                      <xsl:attribute name='MouseMove'>"<xsl:value-of select='@name' />".style.color = '#006AB6';</xsl:attribute>
 <xsl:for-each select="$Attributes/Attribute">
          <xsl:if test=". != ''">
            <xsl:attribute name='{@name}'><xsl:value-of select='.' /></xsl:attribute>
          </xsl:if>
        </xsl:for-each>
        <xsl:copy-of select="$Events" />
      </xsl:element>

该代码用于更改样式,因为它适用于其他对象。

请协助我如何将鼠标悬停事件添加到 WebTextEdit 控件

4

1 回答 1

1

If you always want to run the same (static) JavaScript or dynamic JavaScript generated with XSLT, use the same method as is used to add the id, runat, and Text attributes:

<xsl:attribute name="mouseover">alert('test');</xsl:attribute>

If each control needs to execute different (static) JavaScript, just add an onmouseover attribute to the XML element that triggers this template. The loop will read any attributes in the XML element and pass them on to the generated markup.

于 2009-06-27T08:47:56.520 回答