blindbull
08-09-2002, 04:36 PM
The first block of code below to run a function called 'Hi' and does not work.
The second block of code to run the JS alert function does.
For the first piece of code I can see that when I hover over the image it gives JavaScript:Hi('Server Function');
I cannot understand why one works and the other doesn't. The error I get is object expected. I've put the JS function below also, it's tiny and just for a test.
<xsl:if test="@attribute[. ='Server Function']">
<a>
<xsl:attribute name="href">
JavaScript:Hi('<xsl:value-of select = "@attribute"/>');
</xsl:attribute>
<img src="images/iconactionstart16.gif">
<xsl:attribute name="name">
ServerFunction
</xsl:attribute>
</img>
</a>
</xsl:if>
<xsl:if test="@attribute[. ='Machine Type']">
<a>
<xsl:attribute name="href">
javascript:alert();
</xsl:attribute>
<img src="images/iconactionstart16.gif">
<xsl:attribute name="name">
MachineType
</xsl:attribute>
</img>
</a>
</xsl:if>
function Hi(strNameOfImg)
{
alert(strNameOfImg);
}
The second block of code to run the JS alert function does.
For the first piece of code I can see that when I hover over the image it gives JavaScript:Hi('Server Function');
I cannot understand why one works and the other doesn't. The error I get is object expected. I've put the JS function below also, it's tiny and just for a test.
<xsl:if test="@attribute[. ='Server Function']">
<a>
<xsl:attribute name="href">
JavaScript:Hi('<xsl:value-of select = "@attribute"/>');
</xsl:attribute>
<img src="images/iconactionstart16.gif">
<xsl:attribute name="name">
ServerFunction
</xsl:attribute>
</img>
</a>
</xsl:if>
<xsl:if test="@attribute[. ='Machine Type']">
<a>
<xsl:attribute name="href">
javascript:alert();
</xsl:attribute>
<img src="images/iconactionstart16.gif">
<xsl:attribute name="name">
MachineType
</xsl:attribute>
</img>
</a>
</xsl:if>
function Hi(strNameOfImg)
{
alert(strNameOfImg);
}