Jump to content

Function not executed in IE with variables


VisionMaster

Recommended Posts

Hi, First of all I wasn't surewhere to post this, but I think it's more XSLT problem. Here is the function:

<script type="text/javascript">var xmlDocfunction loadXML(xmlFile, xslFile){// code for IEif (window.ActiveXObject)  {// Load XML var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async = false;xmlDoc.load(xmlFile);// Load XSLvar xslDoc = new ActiveXObject("Microsoft.XMLDOM");xslDoc.async = false;xslDoc.load(xslFile);// Transformdocument.write(xmlDoc.transformNode(xslDoc));  }else if (document.implementation &&document.implementation.createDocument)  {.......For Firefox......

The problem comes when I want to call this function.

<body><script type="text/javascript">function call(){loadXML('XMLdata.xml','XSLdata.xsl');}</script><input type="button" value="Call button"onclick="java script:call();"/><div style="padding:2px;" id="result"></div></body>

I don't know where the problem is. When i manualy put the values it runs....Can I also put the result like in Firefox with innerHTML ?example:document.getElementById("result").innerHTML = (html != null) ? html : "XSLT Failed!"Thanks

Link to comment
Share on other sites

Problem solved, just used instead document.write(xmlDoc.transformNode(xslDoc));i used : target.innerHTML = xmlDoc.transformNode(xslDoc); in the function and in HTML <div id="target"></div> . The problem comes from document.write and changing the vars is not possible except if you create a new doc or somth....(:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...