VBscript XML to JavaScript XML translation?

Hi I got this working with the help of u experts some of you have said that this would be better handled by java script. I know this is a lot to ask but could someone translate the VBscript to JavaScript. Thank you I am very interested in the results.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Connect XML -->
<%Dim objXML,TempfNodeData0,TempfNodeData1,TempfNodeData2,WeatherCond0,WeatherCond1,WeatherCond2,WeatherPic0,WeatherPic1,WeatherPic2,Dateit
Dateit = Date
set objXML = CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")
objXML.async = False
objXML.setProperty "ServerHTTPRequest", true
objXML.Load ("http://www.weather.gov/forecasts/xml/SOAP_server/ndfdSOAPclientByDay.php?lat=47.4828776&lon=-122.2170661&format=24+hourly&startDate=" & Dateit &"&numDays=4&Submit=Submit")
If not objXML.parseError.errorCode <> 0 then
    TempfNodeData0 = objXML.selectsingleNode("/dwml/data/parameters/temperature/value[1]").text
      TempfNodeData1 = objXML.selectsingleNode("/dwml/data/parameters/temperature/value[2]").text
      TempfNodeData2 = objXML.selectsingleNode("/dwml/data/parameters/temperature/value[3]").text
      WeatherPic0 = objXML.selectsingleNode("/dwml/data/parameters/conditions-icon/icon-link[1]").text
      WeatherPic1 = objXML.selectsingleNode("/dwml/data/parameters/conditions-icon/icon-link[2]").text
      WeatherPic2 = objXML.selectsingleNode("/dwml/data/parameters/conditions-icon/icon-link[3]").text
      WeatherCond0 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions[1]").Attributes.getNamedItem("weather-summary").nodeValue
      WeatherCond1 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions[2]").Attributes.getNamedItem("weather-summary").nodeValue
      WeatherCond2 = objXML.selectsingleNode("/dwml/data/parameters/weather/weather-conditions[3]").Attributes.getNamedItem("weather-summary").nodeValue
      'fso.copyFile "n:\pixelfire\images\" & conPATH &"\" & tempBMP, "n:\pixelfire\images\current.jpg"
end if
Set objXML = Nothing %>
<!-- XML loaded for parsing End -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
      background-color: #000000;
      margin-left: 0px;
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
}
.topHeader {
      font-family: Tahoma, Geneva, Arial, Helvetica, Sans-serif;
      font-size: 24px;
      background-image: url(images/pfbackyello.jpg);
      font-weight: bold;
      color: #0000CC;
}
.Bottr {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 24px;
      font-weight: bold;
      color: #FFF300;
      background-image: url(images/pfback2.jpg);
}
.style23 {font-size: 24px; font-family: Tahoma, Geneva, Arial, Helvetica, Sans-serif; font-weight: bold; color: #FFFF00; }
.style24 {
      color: #FFFFFF;
      font-family: Tahoma, Geneva, Arial, Helvetica, Sans-serif;
}
.Graphix {
      background-image: url(images/bk.gif);
}
-->
</style>
</head>

<body>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr class="topHeader" background="images/pfback.png">
<td width="78" height="40" align="center">
<%response.write TempfNodeData0 %>&deg;</td>
<td width="78" height="40" align="center">
<%response.write TempfNodeData1 %>&deg;</td>
<td width="78" height="40" align="center">
 <%response.write TempfNodeData2 %>&deg;</td>
</tr>
<tr class="Graphix">
<td width="78" align="center" bgcolor="#003366"><img src="images/clearsun.gif" alt="today" width="60" height="57" /></td>
<td width="78" align="center" bgcolor="#333333"><img src="images/clearsun.gif" alt="today" width="60" height="57" /></td>
<td width="78" align="center" bgcolor="#333333"><img src="images/cloud.gif" alt="Day after tomorrow" width="60" height="57" /></td>
</tr>
<tr bgcolor="#000099" class="Bottr">
<td width="78" height="40" align="center" class="style23">TUE</td>
<td width="78" height="40" align="center" class="style23">WED</td>
<td width="78" height="40" align="center" class="style23">THUR</td>
</tr>
</table>
<p>&nbsp;</p>
<p><span class="style24">Renton 47.4828776 -122.2170661</span><br />
<span class="style24">
<%response.write WeatherCond0 %>
<br />
<%response.write WeatherCond1 %>
<br />
<%response.write WeatherCond2 %>
<br />
<%response.write WeatherPic0 %>
<br />
<%response.write WeatherPic1 %>
<br />
<%response.write WeatherPic2 %>
</span></p>
</body>
</html>
derekfurmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anthony PerkinsCommented:
>>Hi I got this working with the help of u experts some of you have said that this would be better handled by java script.<<
Actually, I believe the comment you are referring to (made by owenli27) was:
"If it was Java code, I can do it much better. "

Not sure if you realize that Java <> JavaScript

Just my 2 cents worth.
0
derekfurmanAuthor Commented:
I do know that Java and javascript and even Jscript do not =
And I am referring to previous xml posts I have done here and other boards
it is just not the first time I have heard it owenli27

(Kind of strange response but I'll take what I can get will you contribute?)
0
derekfurmanAuthor Commented:
dont get me wrong I like the VBscript Im just interested in the Javascript
0
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Anthony PerkinsCommented:
>>dont get me wrong I like the VBscript Im just interested in the Javascript<<
Fair enough, I just wanted to make sure you realized that Java is compiled code and that ASP only supports VBScript and JavaScript.

Hopefully someone will step up to the plate.
0
Weiping DuSenior Web DeveloperCommented:
Why do you need a client-side script for this?  Anyway, here is some example code and I think that javaScript XML pasring has very limit use in reality.

<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
      background-color: #ffffff;
      margin-left: 0px;
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
}
.topHeader {
      font-family: Tahoma, Geneva, Arial, Helvetica, Sans-serif;
      font-size: 24px;
      background-image: url(images/pfbackyello.jpg);
      font-weight: bold;
      color: #0000CC;
}
.Bottr {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 24px;
      font-weight: bold;
      color: #FFF300;
      background-image: url(images/pfback2.jpg);
}
.style23 {font-size: 24px; font-family: Tahoma, Geneva, Arial, Helvetica, Sans-serif; font-weight: bold; color: #FFFF00; }
.style24 {
      color: #FFFFFF;
      font-family: Tahoma, Geneva, Arial, Helvetica, Sans-serif;
}
.Graphix {
      background-image: url(images/bk.gif);
}
-->
</style>
</head>

<body>
<script type="text/javascript">
      var xml = new ActiveXObject("Microsoft.XMLDOM");
      xml.async="false";
      if(xml.readyState!=4){
            alert("XML object cannot be initialized");
      }
      else{
      var today = new Date();
      var Dateit = today.getYear()+"-"+(today.getMonth()+1)+"-"+today.getDate();      xml.load("http://www.weather.gov/forecasts/xml/SOAP_server/ndfdSOAPclientByDay.php?lat=47.4828776&lon=-122.2170661&format=24+hourly&startDate="+Dateit+"&numDays=4&Submit=Submit");

    var TempNodeList = xml.documentElement.selectNodes("/dwml/data/parameters/temperature/value");
      TempfNodeData0 = TempNodeList[0].firstChild.nodeValue;
    TempfNodeData1 = TempNodeList[1].firstChild.nodeValue;
    TempfNodeData2 = TempNodeList[2].firstChild.nodeValue;

      var WeaNodeList = xml.documentElement.selectNodes("/dwml/data/parameters/conditions-icon/icon-link");
      WeatherPic0 = WeaNodeList[0].firstChild.nodeValue;
      WeatherPic1 = WeaNodeList[1].firstChild.nodeValue;
      WeatherPic2 = WeaNodeList[2].firstChild.nodeValue;

      var CondNodeList = xml.documentElement.selectNodes("/dwml/data/parameters/weather/weather-conditions");
      WeatherCond0 = CondNodeList[0].getAttribute('weather-summary');
      WeatherCond1 = CondNodeList[1].getAttribute('weather-summary');
      WeatherCond2 = CondNodeList[2].getAttribute('weather-summary');
      }

</script>

<table border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr class="topHeader" background="images/pfback.png">
<td width="78" height="40" align="center">
<script type="text/javascript">document.write(TempfNodeData0);</script>&deg;</td>
<td width="78" height="40" align="center">
<script type="text/javascript">document.write(TempfNodeData1);</script>&deg;</td>
<td width="78" height="40" align="center">
<script type="text/javascript">document.write(TempfNodeData2);</script>&deg;</td>
</tr>
<tr class="Graphix">
<td width="78" align="center" bgcolor="#003366"><img src="images/clearsun.gif" alt="today" width="60" height="57" /></td>
<td width="78" align="center" bgcolor="#333333"><img src="images/clearsun.gif" alt="today" width="60" height="57" /></td>
<td width="78" align="center" bgcolor="#333333"><img src="images/cloud.gif" alt="Day after tomorrow" width="60" height="57" /></td>
</tr>
<tr bgcolor="#000099" class="Bottr">
<td width="78" height="40" align="center" class="style23">TUE</td>
<td width="78" height="40" align="center" class="style23">WED</td>
<td width="78" height="40" align="center" class="style23">THUR</td>
</tr>
</table>
<p>&nbsp;</p>
<p>Renton 47.4828776 -122.2170661<br/>
<script type="text/javascript">
document.write("<br/><br/>");
document.write(WeatherCond0);
document.write("<br/>");
document.write("<img src='"+WeatherPic0+"'/>");

document.write("<br/><br/>");
document.write(WeatherCond1);
document.write("<br/>");
document.write("<img src='"+WeatherPic1+"'/>");

document.write("<br/><br/>");
document.write(WeatherCond2);
document.write("<br/>");
document.write("<img src='"+WeatherPic2+"'/>");
</script>
</p>
</body>
</html>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
derekfurmanAuthor Commented:
Thank you owenli27 this is a great example. (I understand this)

What do you mean: “Why do you need a client-side script for this?” is there a better way to handle this?

Please explain I don’t understand but I want to :)

You also said: “JavaScript XML parsing has very limit use in reality.”
Do you mean just java or VBScript as well?

What about XHTML can this be handed with out using asp?

(so many questions lucky I have you experts)
0
Weiping DuSenior Web DeveloperCommented:
Normally, a client (let's say it is a browser) sends request to a server.  Then, server code (Java or VBScript) to download or query XML source data;  parsing XML and extract element or attributes; finally return HTML and result data to client(a browser).   But What I did above is that JavaScript running on browser and download XML directly to your PC buffer and parsing data locally in client-side.  This is not client-server principle and we can see it in few cases
0
derekfurmanAuthor Commented:
interesting suggest a book I should read on the subject?
0
Weiping DuSenior Web DeveloperCommented:
I really don't know any books I should recommend them since I graduated from school 8 years ago. :)
If you just want to know something, focus on client/server. Here is a link

http://www.uow.edu.au/~nabg/WebServer/

http://www.amazon.com/Web-Server-Programming-Neil-Gray/dp/0470850973/ref=pd_bbs_sr_1/102-7172892-8909769?ie=UTF8&s=books&qid=1175026144&sr=1-1
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.