PageRenderTime 33ms CodeModel.GetById 23ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer3/js/KeyDownEvent.js

http://github.com/khaneh/Orders
JavaScript | 44 lines | 23 code | 4 blank | 17 comment | 8 complexity | 89f80d1f374a8d32485bd0cb35795ce2 MD5 | raw file
 1/*
 2	File Version Start - Do not remove this if you are modifying the file
 3	Build: 9.5.0
 4	File Version End
 5*/
 6/*
 7    this function is used to verify whether the 'Enter' key is pressed.
 8    if the 'Enter' key is pressed, then either call the event handler function passed in as a parameter (evntHdlrName)
 9    or if evntHdlrName is an empty string, submit the form that contains the input box (that triggers this function).  
10    The form name is passed in as the third parameter, if it's an empty string, it's set to 0 by default.
11    The first parameter is an event object 
12    
13    written by Paul Chong, 17th May 01
14*/
15
16function keydownfn(e, evntHdlrName, formName)
17{	
18    var nav4;
19    var keyPressed;
20
21    //check if the brower is Netscape Navigator 4 or not
22    var nav4 = window.Event ? true : false;
23	
24	//if browser is Navigator 4, the key pressed is called <event object>.which else it's called <event object>.keyCode
25	keyPressed = nav4 ? e.which : e.keyCode;
26		
27    if (keyPressed == 13)
28    {	
29        if (evntHdlrName != "")
30		{	
31			// append empty parentheses if none given
32			if(evntHdlrName.substr(evntHdlrName.length-1) != ")")
33				evntHdlrName += "()";
34			eval(evntHdlrName);
35        }
36        else
37        {
38			if (formName == "")
39				formName = 0;
40            document.forms[formName].submit();
41        }
42    }
43    return true;
44}