<<<·µ»Ø

Make javascript to ASP
<%@Language=VBScript%> <%Response.Buffer = True%> <% Dim javascripttoasp javascripttoasp = Request.QueryString("javascripttoasp")
Select Case javascripttoasp
Case "javascripttoasphiddenform"
javascripttoasphiddenform
Case "javascripttoasphiddenformresult"
javascripttoasphiddenformresult
Case "javascriptwritestringtootherpageusingget"
javascriptwritestringtootherpageusingget
Case "javascriptstringtootherpageresult"
javascriptstringtootherpageresult
End Select
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head><title>javascript to asp request form</title></head>
<body bgcolor="#333333">
<%
SUB javascripttoasphiddenform
%>
<SCRIPT LANGUAGE="JavaScript1.2">
document.write("<FORM action=sc2001.asp?javascripttoasp=javascripttoasphiddenformresult method=post>")
document.write("<font face=Verdana size=2 color=FFCC00><b>write your name</b><br></font>")
document.write("<input type=text name=yourname>")
document.write("<input type=hidden name=screenheight value=" + screen.height + ">")
document.write("<input type=hidden name=screenavailHeight value=" + screen.availHeight + ">")
document.write("<input type=hidden name=screenwidth value=" + screen.width + ">")
document.write("<input type=hidden name=screenavailWidth value=" + screen.availWidth + ">")
document.write("<input type=hidden name=screencolorDepth value=" + screen.colorDepth + ">")
document.write("<br><input type=submit name=make-values value=makevalues>")
document.write("</FORM>")
</SCRIPT>
<a href="sc2001.asp">
<font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color="#FFCC00">
start over</a> or </font><br>
<a href="#" onClick="window.close()">
<font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color="#FFCC00">
closewindow</a></font><br>
<%
end sub
%>
<%
SUB javascripttoasphiddenformresult
%>
<%
yourname = request.form("yourname")
screenheight = request.form("screenheight")
screenavailHeight = request.form("screenavailHeight")
screenwidth = request.form("screenwidth")
screenavailWidth = request.form("screenavailWidth")
screencolorDepth = request.form("screencolorDepth")
%>
<table width="350" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#000000"><font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2"
color="#FFCC00"><strong>Javascript 1.2</strong></font></td>
<td bgcolor="#000000" align="right"><font face="Verdana,Geneva,Arial,Helvetica,sans-serif"
size="2" color="#FFCC00"><b>values requested</b></font></td>
</tr>
<tr>
<td><font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color="#FFCC00">your
name</font></td>
<td bgcolor="#333366" align="right"><font face="Verdana,Geneva,Arial,Helvetica,sans-serif"
size="2" color="#FFCC00"><b><%= yourname %></b></font></td>
</tr>
<tr>
<td><font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2"
color="#FFCC00">screen.height</font></td>
<td bgcolor="#333366" align="right"><font face="Verdana,Geneva,Arial,Helvetica,sans-serif"
size="2" color="#FFCC00"><b><%= screenheight %></b></font></td>
</tr>
<tr>
<td><font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2"
color="#FFCC00">screen.availHeight</font></td>
<td bgcolor="#333366" align="right"><font face="Verdana,Geneva,Arial,Helvetica,sans-serif"
size="2" color="#FFCC00"><b><%= screenavailHeight %></b></font></td>
</tr>
<tr>
<td><font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2"
color="#FFCC00">screen.width</font></td>
<td bgcolor="#333366" align="right"><font face="Verdana,Geneva,Arial,Helvetica,sans-serif"
size="2" color="#FFCC00"><b><%= screenwidth %></b></font></td>
</tr>
<tr>
<td><font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2"
color="#FFCC00">screen.availWidth</font></td>
<td bgcolor="#333366" align="right"><font face="Verdana,Geneva,Arial,Helvetica,sans-serif"
size="2" color="#FFCC00"><b><%= screenavailWidth %></b></font></td>
</tr>
<tr>
<td><font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2"
color="#FFCC00">screen.colorDepth</font></td>
<td bgcolor="#333366" align="right"><font face="Verdana,Geneva,Arial,Helvetica,sans-serif"
size="2" color="#FFCC00"><b><%= screencolorDepth %></b></font></td>
</tr>
</table>
<br><br><a href="sc2001.asp">
<font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color="#FFCC00">
start over</a> or </font><br>
<a href="#" onClick="window.close()">
<font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color="#FFCC00">
closewindow</a> or </font><br>
<a href="<% = Request.ServerVariables("SCRIPT_NAME") %>?
javascripttoasp=javascriptwritestringtootherpageusingget">
<font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color="#FFCC00">
choose <b>GET</b> to get javascript values</a></font><br><br>
<%
end sub
%>
<%
SUB javascriptwritestringtootherpageusingget
%>
<script language="javascript">
s = "&swh="+screen.width+" x "+screen.height+"&d="+screen.colorDepth+"&swha="+screen.availWidth+"
x "+screen.availHeight
location.href="sc2001.asp?javascripttoasp=javascriptstringtootherpageresult"+s
</script>
<%
end sub
%>
<%
SUB javascriptstringtootherpageresult
swh=request.QueryString("swh")
d=request.QueryString("d")
swha=request.QueryString("swha")
response.write "<font face=""Verdana"" size=""2"" color=""#FFCC00""><b>Screen width x height = "& swh
&"<br>"
response.write "Screen colordepth = "& d &"<br>"
response.write "Screen availWidth x availHeight = "& swha &"<br><br></b></font>"
%>
<br><br><a href="sc2001.asp">
<font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color="#FFCC00">
start over</a> or </font><br>
<a href="#" onClick="window.close()">
<font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color="#FFCC00">
closewindow</a> or </font><br>
<a href="<% = Request.ServerVariables("SCRIPT_NAME") %>?javascripttoasp=javascripttoasphiddenform">
<font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color="#FFCC00">
choose <b>POST FORM</b> to get javascript values</a></font><br><br>
<%
end sub
%>
<%
¡® write out start of the page with now selected case yet
if javascripttoasp="" then
%>
<a href="<% = Request.ServerVariables("SCRIPT_NAME") %>?javascripttoasp=javascripttoasphiddenform">
<font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color="#FFCC00">
choose <b>POST FORM</b> to get javascript values</a></font><br>
<a href="<% = Request.ServerVariables("SCRIPT_NAME") %>?
javascripttoasp=javascriptwritestringtootherpageusingget">
<font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color="#FFCC00">
choose <b>GET</b> to get javascript values</a></font><br><br>
<a href="#" onClick="window.close()">
<font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color="#FFCC00">
closewindow</a></font><br>
<%
end if
%>
</body>
</html>