I need to retrive value of the variable to which has been assign value on click event. The value is dynamicaly read from xml. I know that correct value is assign to propertyNum as I tried command document.write(propertyNum);
after value assign to just check it.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Preview</title>
<script type="text/javascript">
(document.getElementById ? DOMCapable = true : DOMCapable = false);
var propertyNum = '';
function show(property)
{
if(DOMCapable)
{
if(property == "group")
{
document.getElementById("group").style.display="block";
document.getElementById("group").style.visibility="visible";
document.getElementById("single").style.display="none";
document.getElementById("single").style.visibility="hidden";
propertyNum = "";
}
else
{
propertyNum = property;
//document.write(propertyNum);
document.getElementById("single").style.display="block";
document.getElementById("single").style.visibility="visible";
document.getElementById("group").style.display="none";
document.getElementById("group").style.visibility="hidden";
}
}
}
function getPropertyNum()
{
return propertyNum;
}
</script>
</head>
<body>
<div id="group" onClick="show('single');">
<p style="cursor: pointer;"> <xsl:attribute name="onClick">show('<xsl:value-of select='id/num'/>');</xsl:attribute>
More details <xsl:value-of select='system/address1'/></p>
</div>
<div id="single" onClick="show('group');" style="display:none; visibility: hidden;">
<p id="propertyNum" name="propertyNum">Selected property ID is :<script type="text/javascript"> getPropertyNum();</script>
</p>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The red marked part however does not return any value. Can somebody advice?