I would like to be able to view/show variables from the querystring sent to checkoptions.asp
Can anyone help - point me in the right direction?
Here is what I have so far: -
Many Thanks!
// FORM.ASP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"<html>
<head>
<script language="JavaScript" type="text/javascript" src="calculate.js"></script>
</head>
<body>
<div id="ValidationResult">validation results will appear here</div>
<form name="calc" method="post">
<table width="258" border="0" cellpadding="3" >
<tr>
<td colspan="2"><h4>calculator</h4></td>
</tr>
<tr>
<th width="50%" align="left">option</th>
<th width="50%" align="right">select</th>
</tr>
<tr>
<td>option 1</td>
<td align="right"><input type="checkbox" name="option1"></td>
</tr>
<tr>
<td>option 2</td>
<td align="right"><input type="checkbox" name="option2"></td>
</tr>
<tr>
<td>option 3</td>
<td align="right"><input type="checkbox" name="option3"></td>
</tr>
<tr>
<td>option 4</td>
<td align="right"><input type="checkbox" name="option4"></td>
</tr>
<tr>
<td><strong>price</strong></td>
<td align="right"><input type="text" name="pay"></td>
</tr>
<tr>
<td align="center"></td>
<td align="right"> </td>
</tr>
<tr>
<td align="center"></td>
<td align="right"><input type="button" onClick="count()" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>
// CHECKOPTIONS.ASP
<%
Response.Write(Request.ServerVariables("QUERY_STRING"))
%>
// CALCULATE.JS
var strAgentString = navigator.userAgent.toLowerCase(); // The agent info from the browser
var strBrowser; // Full browser name
var strBrowserCode; // Brief browser code
var strBrowserVersion; // Browser version
var strOS; // Operating system
var strWorkString; // Work string
if (InAgentString('konqueror'))
{
strBrowser = "Konqueror";
strOS = "Linux";
}
else if (InAgentString('firefox')) {
strBrowser = "Firefox";
strBrowserCode = "FF";
}
else if (InAgentString('icab')) {
strBrowser = "iCab";
strBrowserCode = "IC";
}
else if (InAgentString('msie')) {
strBrowser = "Internet Explorer";
strBrowserCode = "IE";
}
else if (InAgentString('omniweb')) {
strBrowser = "OmniWeb";
strBrowserCode = "OW";
}
else if (InAgentString('opera')) {
strBrowser = "Opera";
strBrowserCode = "OP";
}
else if (InAgentString('safari')) {
strBrowser = "Safari";
strBrowserCode = "SA";
}
else if (InAgentString('webtv')) {
strBrowser = "WebTV";
strBrowser = "WT";
}
else if (!InAgentString('compatible'))
{
strBrowser = "Netscape Navigator";
strBrowserCode = "NN";
strBrowserVersion = strAgentString.charAt(8);
}
else
{
strBrowser = "An unknown browser";
strBrowserCode = "XX";
}
if (!strBrowserVersion) strBrowserVersion = strAgentString.charAt(intPos + strWorkString.length);
if (!strOS)
{
if (InAgentString('linux')) strOS = "Linux";
else if (InAgentString('x11')) strOS = "Unix";
else if (InAgentString('mac')) strOS = "Mac"
else if (InAgentString('win')) strOS = "Windows"
else strOS = "An unknown OS";
}
function InAgentString(string) {
intPos = strAgentString.indexOf(string) + 1;
strWorkString = string;
return intPos;
}
function GetXmlHttpObject() {
var xmlHttp=null
if (navigator.userAgent.indexOf("Opera")>=0)
{
xmlHttp=new XMLHttpRequest()
return xmlHttp
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{
var strName="Msxml2.xmlHttp"
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.xmlHttp"
}
try
{
xmlHttp=new ActiveXObject(strName)
return xmlHttp
}
catch(e)
{
alert("Error. Scripting for ActiveX might be disabled")
return
}
}
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
xmlHttp=new XMLHttpRequest()
return xmlHttp
}
}
function count() {
// Collect FORM fields
str_option1 = document.calc.option1.checked
str_option2 = document.calc.option2.checked
str_option3 = document.calc.option3.checked
str_option4 = document.calc.option4.checked
// Send/recv
var xmlHttp;
xmlHttp = GetXmlHttpObject();
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
PopDIV("ValidationResult", xmlHttp.responseText);
return xmlHttp.responseText;
}
}
var URL = "checkoptions.asp";
URL = URL + "?option1=" + str_option1;
URL = URL + "&option2=" + str_option2;
URL = URL + "&option3=" + str_option3;
URL = URL + "&option4=" + str_option4;
xmlHttp.open("GET",URL,true);
xmlHttp.send(null);
}
function PopDIV(strDIV, strMessage) {
if (strBrowserCode == "IE")
{
eval("document.all." + strDIV + ".innerHTML='" + strMessage + "';");
}
if (strBrowserCode == "FF" || strBrowserCode == "NN" || strBrowserCode == "OP" || strBrowserCode == "SA")
{
eval("document.getElementById('" + strDIV + "').innerHTML='" + strMessage + "';");
}
return true;
}
Can anyone help - point me in the right direction?
Here is what I have so far: -
Many Thanks!
// FORM.ASP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"<html>
<head>
<script language="JavaScript" type="text/javascript" src="calculate.js"></script>
</head>
<body>
<div id="ValidationResult">validation results will appear here</div>
<form name="calc" method="post">
<table width="258" border="0" cellpadding="3" >
<tr>
<td colspan="2"><h4>calculator</h4></td>
</tr>
<tr>
<th width="50%" align="left">option</th>
<th width="50%" align="right">select</th>
</tr>
<tr>
<td>option 1</td>
<td align="right"><input type="checkbox" name="option1"></td>
</tr>
<tr>
<td>option 2</td>
<td align="right"><input type="checkbox" name="option2"></td>
</tr>
<tr>
<td>option 3</td>
<td align="right"><input type="checkbox" name="option3"></td>
</tr>
<tr>
<td>option 4</td>
<td align="right"><input type="checkbox" name="option4"></td>
</tr>
<tr>
<td><strong>price</strong></td>
<td align="right"><input type="text" name="pay"></td>
</tr>
<tr>
<td align="center"></td>
<td align="right"> </td>
</tr>
<tr>
<td align="center"></td>
<td align="right"><input type="button" onClick="count()" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>
// CHECKOPTIONS.ASP
<%
Response.Write(Request.ServerVariables("QUERY_STRING"))
%>
// CALCULATE.JS
var strAgentString = navigator.userAgent.toLowerCase(); // The agent info from the browser
var strBrowser; // Full browser name
var strBrowserCode; // Brief browser code
var strBrowserVersion; // Browser version
var strOS; // Operating system
var strWorkString; // Work string
if (InAgentString('konqueror'))
{
strBrowser = "Konqueror";
strOS = "Linux";
}
else if (InAgentString('firefox')) {
strBrowser = "Firefox";
strBrowserCode = "FF";
}
else if (InAgentString('icab')) {
strBrowser = "iCab";
strBrowserCode = "IC";
}
else if (InAgentString('msie')) {
strBrowser = "Internet Explorer";
strBrowserCode = "IE";
}
else if (InAgentString('omniweb')) {
strBrowser = "OmniWeb";
strBrowserCode = "OW";
}
else if (InAgentString('opera')) {
strBrowser = "Opera";
strBrowserCode = "OP";
}
else if (InAgentString('safari')) {
strBrowser = "Safari";
strBrowserCode = "SA";
}
else if (InAgentString('webtv')) {
strBrowser = "WebTV";
strBrowser = "WT";
}
else if (!InAgentString('compatible'))
{
strBrowser = "Netscape Navigator";
strBrowserCode = "NN";
strBrowserVersion = strAgentString.charAt(8);
}
else
{
strBrowser = "An unknown browser";
strBrowserCode = "XX";
}
if (!strBrowserVersion) strBrowserVersion = strAgentString.charAt(intPos + strWorkString.length);
if (!strOS)
{
if (InAgentString('linux')) strOS = "Linux";
else if (InAgentString('x11')) strOS = "Unix";
else if (InAgentString('mac')) strOS = "Mac"
else if (InAgentString('win')) strOS = "Windows"
else strOS = "An unknown OS";
}
function InAgentString(string) {
intPos = strAgentString.indexOf(string) + 1;
strWorkString = string;
return intPos;
}
function GetXmlHttpObject() {
var xmlHttp=null
if (navigator.userAgent.indexOf("Opera")>=0)
{
xmlHttp=new XMLHttpRequest()
return xmlHttp
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{
var strName="Msxml2.xmlHttp"
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.xmlHttp"
}
try
{
xmlHttp=new ActiveXObject(strName)
return xmlHttp
}
catch(e)
{
alert("Error. Scripting for ActiveX might be disabled")
return
}
}
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
xmlHttp=new XMLHttpRequest()
return xmlHttp
}
}
function count() {
// Collect FORM fields
str_option1 = document.calc.option1.checked
str_option2 = document.calc.option2.checked
str_option3 = document.calc.option3.checked
str_option4 = document.calc.option4.checked
// Send/recv
var xmlHttp;
xmlHttp = GetXmlHttpObject();
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
PopDIV("ValidationResult", xmlHttp.responseText);
return xmlHttp.responseText;
}
}
var URL = "checkoptions.asp";
URL = URL + "?option1=" + str_option1;
URL = URL + "&option2=" + str_option2;
URL = URL + "&option3=" + str_option3;
URL = URL + "&option4=" + str_option4;
xmlHttp.open("GET",URL,true);
xmlHttp.send(null);
}
function PopDIV(strDIV, strMessage) {
if (strBrowserCode == "IE")
{
eval("document.all." + strDIV + ".innerHTML='" + strMessage + "';");
}
if (strBrowserCode == "FF" || strBrowserCode == "NN" || strBrowserCode == "OP" || strBrowserCode == "SA")
{
eval("document.getElementById('" + strDIV + "').innerHTML='" + strMessage + "';");
}
return true;
}