Results 1 to 2 of 2

Thread: How do you capture a querystring value without a click

  1. #1
    Join Date
    Feb 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How do you capture a querystring value without a click

    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

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    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.

    Code:
    <!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

    Code:
    <%@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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •