OK, I am trying to make a hit counter for my web page but I can't, I keep getting a compilation error. Here is my code that is the problem, but the thing is I don't know why it's wrong.
CODE
<script language="JScript" runat="server">
var counterDoc : XmlDocument = Server.MapPath("design/server/hits/home.xml");
var counterTag : XmlElement = counterDoc.getElementById("hits");
var hits : Int = counterTag.value.ToInteger;
var counter : Int = hits + 1;
counterDoc.file.RemoveChild("counter");
counterDoc.file.CreateElement("counter");
counterDoc.file.counter.SetAttribute("id", "hits");
counterDoc.file.counter.AppendChild(counterDoc.CreateTextNode(counter));
counterDoc.Save("design/server/hits/home.xml");
</script>
And my XML document
CODE
<?xml version = "1.0"?>
<file>
<counter id="hits">0</counter>
</file>
I just can't see whats wrong, can someone help me get to the bottom of this or show me an easier way of doing this?
If you want to see what the error is go to
this link.
This post has been edited by trickstar34: 30 Jun, 2009 - 09:30 PM