Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscript from asp to html

Status
Not open for further replies.

marcel2

Vendor
Mar 9, 2003
14
NL
Hello,

I hope someone is able to help me with this script. I do not understand anything of vbscripting, I did work with javascript only. I got a ASP page with vbscript init but my provider is not suporting asp is it posible to make the vbscript work in html pages? I hope you are able to get this script started for me.
<SCRIPT LANGUAGE=&quot;VBScript&quot;>
<!--
dim objXMLHTTP
dim thezipcode
thezipcode = 48430
URL = &quot; & thezipcode & &quot;&metric=0&quot;
Set objXMLHTTP = Server.CreateObject(&quot;Microsoft.XMLHTTP&quot;)
objXMLHTTP.Open &quot;GET&quot;, URL, false
objXMLHTTP.Send

If InStr(objXMLHTTP.responsetext, &quot;<tr bgcolor=&quot;&quot;#ffffff&quot;&quot;>&quot;) = 0 Then
start = 0
else
start = InStr(objXMLHTTP.responsetext, &quot;<tr bgcolor=&quot;&quot;#ffffff&quot;&quot;>&quot;)
end if

If InStr(objXMLHTTP.responsetext, &quot;<tr bgcolor=&quot;&quot;#E5E1D9&quot;&quot;>&quot;) = 0 Then
finish = 1
else
finish = InStr(objXMLHTTP.responsetext, &quot;<tr bgcolor=&quot;&quot;#E5E1D9&quot;&quot;>&quot;)
amount = finish - start
extract = Mid(objXMLHTTP.responsetext,start,amount)
end if

extract = Replace(extract, &quot; &quot;&quot;)
extract = Replace(extract, &quot;RealFeel[TM]&quot;, &quot;Feels Like&quot;)
extract = Replace(extract, &quot;RF&quot;, &quot;Feels Like&quot;)

'Response.Write &quot;<hr>&quot;
'Response.Write &quot;<h4>HTML Code for&nbsp&quot;&URL&&quot;</h4>&quot;
'Response.Write &quot;<textarea rows=30 cols=120>&quot;
Response.write &quot;<table width=&quot;&quot;315&quot;&quot; cellpadding=&quot;&quot;6&quot;&quot; cellspacing=&quot;&quot;0&quot;&quot; border=&quot;&quot;0&quot;&quot;>&quot;
Response.Write extract 'objXMLHTTP.responseText
Response.write &quot;</table>&quot;
Response.write &quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font size=&quot;&quot;-1&quot;&quot;><a href=&quot;&quot; by Weather Connect</b></a></font>&quot;
'Response.Write &quot;</textarea>&quot;
Set objXMLHTTP = Nothing
-->
</SCRIPT>
Thanks for your help.
Greatings
Marcel
 
Well I already compiled it, but I don't know what it is suppose to be some I can't tell you that is working correctly or not.
 
Here is what I have so far.

<%

thezipcode = &quot;48430&quot;
URL = &quot; & thezipcode & &quot;&metric=0&quot;
Set objXMLHTTP = Server.CreateObject(&quot;Microsoft.XMLHTTP&quot;)
objXMLHTTP.Open &quot;GET&quot;, URL, false
objXMLHTTP.Send

If InStr(objXMLHTTP.responsetext, &quot;<tr bgcolor=#ffffff>&quot;) = 0 Then
start = 0
else
start = InStr(objXMLHTTP.responsetext, &quot;<tr bgcolor=#ffffff>&quot;)
end if

If InStr(objXMLHTTP.responsetext, &quot;<tr bgcolor=#E5E1D9>&quot;) = 0 Then
finish = 1
else
finish = InStr(objXMLHTTP.responsetext, &quot;<tr bgcolor=#E5E1D9>&quot;)
amount = finish - start
extract = Mid(objXMLHTTP.responsetext,start,amount)
end if

extract = Replace(extract, &quot; &quot;&quot;)
extract = Replace(extract, &quot;RealFeel[TM]&quot;, &quot;Feels Like&quot;)
extract = Replace(extract, &quot;RF&quot;, &quot;Feels Like&quot;)

'Response.Write &quot;<hr>&quot;
'Response.Write &quot;<h4>HTML Code for &quot;&URL&&quot;</h4>&quot;
'Response.Write &quot;<textarea rows=30 cols=120>&quot;
Response.write &quot;<table width=&quot;&quot;315&quot;&quot; cellpadding=&quot;&quot;6&quot;&quot; cellspacing=&quot;&quot;0&quot;&quot; border=&quot;&quot;0&quot;&quot;>&quot;
Response.Write extract 'objXMLHTTP.responseText
Response.write &quot;</table>&quot;
Response.write &quot;       <font size=&quot;&quot;-1&quot;&quot;><a href=&quot;&quot; by Weather Connect</b></a></font>&quot;
'Response.Write &quot;</textarea>&quot;
Set objXMLHTTP = Nothing
%>
 
You may want to ask this in the VBScript, ASP, or Javascript forums, as those would have more bearing on this question. Though my advice would be to get a host that supports ASP, as runing this in it's original format will be much easier than attempting to force a client-side script (VBScrip or Javascript) to generate the page on the fly. Some of the inherent problems are the browser compatibility issues, the fact that some peop eturn off client-side scripting, and that you can force a refresh if they hit a back button, but the page may not display any of the elements you have added (such as the table and such from above).

-Tarwn 01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101
29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top