Jump to content

How to use variables from XML in to HTML


Recommended Posts

Hi to all,I just wonder, is it possible, and if yes - how? If I have in a xml file for examle two tags/nodes like

<XMLleft> 100px </XMLleft><XMLtop> 200px </XMLtop>

and how can I then use them for example like this in the HTML :

<div style="position:absolute;left:XMLleft;top:XMLtop;z-index:1; "> Bla bla </div>


Link to comment
Share on other sites

Hi, I still can't figure out how to pull out a number value out of the XML. I have it displayed but can't use it as a varibale later in javascript...

<script type="text/javascript"for="window" event="onload">var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")xmlDoc.async="false"xmlDoc.load("test.xml")nodes=xmlDoc.documentElement.childNodes;size.innerText=  nodes.item(0).childNodes.item(2).text;</script>

<div id="size"></div> - returns me the number 6 for example, the number which I need to use in another jscript . How can I convert it to Number ? Thanks!

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...