Click here to Skip to main content
15,895,423 members
Home / Discussions / Web Development
   

Web Development

 
QuestionWhat would be the best solution Pin
j45mw26-Mar-05 4:08
j45mw26-Mar-05 4:08 
GeneralSpeech application problems on the south of France Pin
Member 167953425-Mar-05 21:03
Member 167953425-Mar-05 21:03 
Generalinclude files and event handling Pin
gagirl_4325-Mar-05 9:06
gagirl_4325-Mar-05 9:06 
GeneralRe: include files and event handling Pin
Roger Wright26-Mar-05 4:14
professionalRoger Wright26-Mar-05 4:14 
GeneralRe: include files and event handling Pin
gagirl_4328-Mar-05 3:43
gagirl_4328-Mar-05 3:43 
GeneralRe: include files and event handling Pin
Jesse Evans23-Mar-06 9:27
Jesse Evans23-Mar-06 9:27 
GeneralRe: include files and event handling Pin
gagirl_4323-Mar-06 13:55
gagirl_4323-Mar-06 13:55 
GeneralRe: include files and event handling Pin
Jesse Evans24-Mar-06 6:03
Jesse Evans24-Mar-06 6:03 
Rhonda,

I managed to work out a solution on my own then another person from CP offered a method that works without the complexity of my method.

My method was to trap keystrokes in the text control by adding a handler for the onkeypress event. The handler checks for the ENTER key and calls the appropriate subroutine when it arrives:
<br />
<script language=jscript><br />
function MySub()<br />
{<br />
// do something interesting...<br />
}<br />
function CheckForEnter()<br />
{<br />
   if(event.keyCode == 13)<br />
      MySub();<br />
}   <br />
</script><br />
<input type="text" onchange="CheckForEnter()"><br />

(Note: for some reason CP is changing OnChange to removed in the above codeblock. Likewise for OnSubmit below.)

The other method is to wrap the entry field in a FORM block, then add a handler for the Form's onSubmit event. The trick is to return false from the event handler; that prevents the form from trying to reload the page:
<br />
<script language=jscript><br />
function MySub()<br />
{<br />
// do something interesting...<br />
}<br />
</script><br />
<form onsubmit="MySub(); return false;"><br />
<input type="text"><br />
</form><br />

I'm choosing to use the second method; it just seems cleaner.

Thanks for your help.



'til next we type...
HAVE FUN!! -- Jesse
Questionhow to send and receive sms from internet Pin
govindnaroji25-Mar-05 7:23
govindnaroji25-Mar-05 7:23 
Questionasp:button image? Pin
bizjosh25-Mar-05 0:19
bizjosh25-Mar-05 0:19 
General[ASP.net / C#] Checkbox Checked Always false Pin
Jaymz66624-Mar-05 23:57
Jaymz66624-Mar-05 23:57 
GeneralRe: [ASP.net / C#] Checkbox Checked Always false Pin
Jeff Martin28-Mar-05 7:38
Jeff Martin28-Mar-05 7:38 
GeneralRe: [ASP.net / C#] Checkbox Checked Always false Pin
Jaymz66628-Mar-05 21:41
Jaymz66628-Mar-05 21:41 
GeneralRe: [ASP.net / C#] Checkbox Checked Always false Pin
Jeff Martin29-Mar-05 3:13
Jeff Martin29-Mar-05 3:13 
GeneralJavascript for adding html Pin
shaiba24-Mar-05 19:12
shaiba24-Mar-05 19:12 
GeneralRe: Javascript for adding html Pin
Yulianto.27-Mar-05 15:37
Yulianto.27-Mar-05 15:37 
GeneralRe: Javascript for adding html Pin
Anonymous27-Mar-05 17:33
Anonymous27-Mar-05 17:33 
GeneralRe: Javascript for adding html Pin
Yulianto.27-Mar-05 17:47
Yulianto.27-Mar-05 17:47 
GeneralASP.NET VB on DWMX for User Registration page Pin
bizjosh24-Mar-05 17:36
bizjosh24-Mar-05 17:36 
GeneralCSocket &amp; critical sections under IIS 6 Pin
Sorin24-Mar-05 15:48
Sorin24-Mar-05 15:48 
GeneralASP cant read the data from the Access database Pin
Member 145397924-Mar-05 15:39
Member 145397924-Mar-05 15:39 
GeneralRe: ASP cant read the data from the Access database Pin
Hesham Amin26-Mar-05 0:53
Hesham Amin26-Mar-05 0:53 
GeneralProblems Transfering div contents x-browser Pin
loane24-Mar-05 12:40
loane24-Mar-05 12:40 
GeneralQuestion regarding using the same input! Pin
Jamal42024-Mar-05 10:42
Jamal42024-Mar-05 10:42 
Generalcombo control appear infront of menu Pin
TariqMahmood24-Mar-05 0:41
TariqMahmood24-Mar-05 0:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.