PDA

View Full Version : How do you capture a querystring value without a click



Theo90
02-26-2007, 08:40 PM
Hello world,


I'm new to this!

I need help with this problem.

I need to capture a value using onMouseOver without clicking the mouse.


Any help would be great.

Thanks

codeexploiter
02-27-2007, 02:46 AM
The following code snippet which is in ASP (since this is ASP forums I hope you are here for an ASP solution) does the value passing without pressing a button (a submit button).

In the following example two code snippets are there:

1. The first one is an HTML (form interface) file that accepts the input from the user.

2. An ASP file that accepts the incoming input from the first file and does the manipulation.



<!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">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
function validate()
{
var valStore = document.first.name.value;
valStore = trim(valStore);
if(valStore.length == 0)
return false
return true;
}
function LTrim( value )
{
var re = /\s*((\S+\s*)*)/;
return value.replace(re, "$1");
}

function RTrim( value )
{
var re = /((\s*\S+)*)\s*/;
return value.replace(re, "$1");
}


function trim( value )
{
return LTrim(RTrim(value));
}

function finalCheck()
{
var status = validate();

if(status)
document.first.submit();
else
alert("Enter value properly");
}
</script>
</head>

<body>
<form action="act.asp" method="get" name="first">
<label>Enter the name</label><input name="name" type="text" size="20" /><br>
<br>
</form>
<a href="#" onmouseover="finalCheck();">Hover your mouse here</a>

</body>
</html>


You have to save this file either into your web publishing root of your web server In case of ASP I assume that you are using IIS and the web publishing root of it is C:\Inetpub\wwwroot.

The following is the code snippet for the ASP file



<%@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">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<%
Dim var
var = Request.QueryString("name")

response.Write("The value entered in the first page: "& var)
%>
</body>
</html>


Please note to save the second file as act.asp as I've mentioned that name in the <form> tag of the first file (HTML).

The next step is to load the HTML page (I assume that you saved the page in web publishing root directory) using the browser which will have the following syntax:

http://localhost/htmlInterface.htm

You need to enter some value otherwise your form will not be submitted; enter some value and hover your mouse over the link placed there (if you click on the link it won't do nothing)

If you have any problem with these pages feel free to post it here.

regards