How to make "enter" work in HTML syntax


 
Thread Tools Search this Thread
Top Forums Web Development How to make "enter" work in HTML syntax
# 1  
Old 11-24-2010
How to make "enter" work in HTML syntax

I have one syntax to find something from desktop on server, the script is as below, I actually speaking don't know anything in this script.

It creates a window, where i get a drop down boxes with folder names given below and a blank box where i have to put the folder name to search. and then I have to click on the "Click to Find" button in window by mouse. What I need is instead on using the mouse click i should get the results after pressing "enter" on keyboard, can anyone please help me on this.


Code:
<html>
<head>
<title>:: Desktop Search ::</title>
<style>
  .submit { cursor: hand;border:none; background-color:white; font-family:arial: font-size:11pt;font-weight:bold; }
</style>

<script language="javascript">
// Global variables

	var curdate = new Date();
	var year = curdate.getYear(); // eg 2008
	var yr = year.toString();


	function clearDefault(el) {
		if (el.defaultValue==el.value) el.value = "";
	}

	function putDefault(el) {
		if (el.value=="") el.value = el.defaultValue;
	}

   function setPath()
   {
	    document.frm1.path.value = "";
		
	    var folder = document.frm1.folder.value;
	    var slash = document.frm1.slash.value;
	    var path = document.frm1.DefaultPath.value+slash+folder+slash;
	    document.frm1.path.value = path;
    }

    function setActualPath()
    {
	    var slash = document.frm1.slash.value;
	    var ActualPath =  document.frm1.path.value+document.frm1.PID.value;
        document.forms[0].action= ActualPath;
        document.forms[0].reset();

        return true;
    }

    function Search()
    {
    if ( setActualPath()==false ) alert("Hello");
    }
</script>
</head>
<body>
<center>
<form action="\\172.20.128.15\Usdp\tnsi\NEWSTRUC" name="frm1" method="post" target="_blank">
<p>
<select name="folder" onChange="setPath()">
   <option value="0"> Select Folder </option>
   <option value="CCA"> CCA </option>
   <option value="FIN"> FIN </option>
   <option value="BUF"> BUF </option>
   <option value="OMA"> OMA </option>
   <option value="ITA"> ITA </option>
   <option value="AUA"> AUA </option>
   <option value="TEL"> TEL </option>
   <option value="POA"> POA </option>
   <option value="OTZ"> OTZ </option>
   <option value="HEA"> HEA </option>
</select>

<INPUT type="text" id="PID" size="13" Value="Enter Project No." onclick='clearDefault(this)' onblur='putDefault(this);'>
</b>
<p>
<INPUT class="submit" type="submit" tabindex="1" value="Click To Find" onClick="setActualPath()">

<INPUT type="hidden" name="path" value="">
<INPUT type="hidden" name="slash" value="\">
<INPUT type="hidden" name="DefaultPath" value="\\172.20.128.15\Usdp\tnsi\NEWSTRUC">
<INPUT type="hidden" name="ActualPath" value="">
</form>
</center>
</body>
</html>

Moderator's Comments:
Mod Comment Please use [CODE] tags to format any kind of listing. You've got an PM on how to do that.

Last edited by pludi; 11-24-2010 at 06:20 PM..
# 2  
Old 11-24-2010
Try adding this to your submit tag:

Code:
onkeydown="if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) setActualPath()"

# 3  
Old 11-26-2010
Its' working

Thanks very much!Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Libjpeg "make install" does not work.

Hello. I recently downloaded, configured and executed make on libjpeg. Until there all worked well. Then suddenly when executing what shall be the simplest part, it returned this error message: I have no idea as to why this problem is happening, since cjpeg was successfully built. This is... (4 Replies)
Discussion started by: colt
4 Replies

2. Shell Programming and Scripting

Syntax error near unexpected token `"Hit <ENTER> to continue:"'

the below code will search attr string inside makefile under the modelno on given path. echo "Enter model no for searching string inside makefile" read inputs2 #find /pools/home_unix/sapte/work/models/model/$inputs2 -name "makefile" | xargs grep "attr" \; #;;I am getting below error.... (7 Replies)
Discussion started by: lathigara
7 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Shell Programming and Scripting

Make scipt except from "Y","y" and "yes" to take [Enter] as being "yes"

This is the script: #!/bin/sh if ; then rm -rf /usr/share/WallpaperChanger; fi if ; then rm -rf /usr/bin/wallch; fi; if ; then rm -rf /usr/share/applications/wallch.desktop; fi if ; then rm -rf /usr/share/doc/wallch; fi if ; then rm -rf /usr/share/man/man1/wallch.1.gz; fi echo "Delete... (4 Replies)
Discussion started by: hakermania
4 Replies

5. OS X (Apple)

Neither "which" nor "find" commands work

hi there, could use some basic PATH advice, i think, or something find sometimes work, but which hasn't ever seemed to. for years! what am i doing wrong that the commands which and find rarely work? they used to work on the workstations i used ages ago... running 10.5.8 because i... (4 Replies)
Discussion started by: zensnob
4 Replies

6. Shell Programming and Scripting

Pressing "Enter/Space bar" using Net::TELNET? in Perl

I'm trying to learn how to get my script to execute the enter button when it telnets into a router and the router displays output but you need to press the space bar or enter button to continue displaying my output of the router. How is this done? (0 Replies)
Discussion started by: xmaverick
0 Replies

7. Programming

how could i make a program mixed with many "|", "<" and ">"

I have written following code to do: ls -l | wc -w, it works: but when there are not only a single "|", if there are more such as: ls -l | sort -r | sort | sort -r, This program does not work, i want to know how could i deal with it when there are more "|", another situation is that, if it mixes... (2 Replies)
Discussion started by: strugglingman
2 Replies

8. UNIX for Dummies Questions & Answers

"./cofigure" and "make" turmoil

I am a Unix newbie and I downloaded some X11 programs. I have gcc, but I cannot compile the files. I NEED HELP!!!! :confused: (16 Replies)
Discussion started by: gnerd
16 Replies
Login or Register to Ask a Question