Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what am i doing wrond

Status
Not open for further replies.

ABJ

Technical User
Aug 29, 2000
16
AU
Hey guy can anyone help
what i am trying to do is get the enter key on the key board to work aswell as the button button the enter key wont work
if anyone can help it will be very much appreciated
Regards Al

<html>

<head>
<title></title>
<style type=&quot;text/css&quot;>
<!--

A:link {text-decoration: none;}
A:visited {text-decoration: none;}
A:hover {text-decoration: underline overline; overline; color:navy;}

-->
</style>
</head>

<body>

<form name=&quot;bulletin&quot;>
<div align=&quot;center&quot;><center><p> </p>
</center></div><div align=&quot;center&quot;><center><p><script language=&quot;JavaScript&quot;><!--

function enterpress(e){
if(document.layers){
thekey=e.which
}
else{
thekey=event.keyCode()
}
if(thekey==&quot;13&quot;)
{grasppasswd()}
}
// --></script></p>
</center></div><div align=&quot;center&quot;><center><p> </p>
</center></div><div align=&quot;center&quot;><center><p> </p>
</center></div><div align=&quot;center&quot;><center><p> </p>
</center></div><div align=&quot;center&quot;><center><table border=&quot;0&quot; cellpadding=&quot;4&quot;
cellspacing=&quot;0&quot; width=&quot;38%&quot;>
<tr>
<td width=&quot;52%&quot;><strong><font face=&quot;Arial&quot;><font color=&quot;#000000&quot;>   1.  
Enter Bulletin Number </font><p><font color=&quot;#000000&quot;>   2.  Click the go
button</font></p>
</font></strong><div align=&quot;center&quot;><center><p>     <input type=&quot;text&quot;
name=&quot;number&quot; size=&quot;10 onkeypress=&quot; enterpress()&quot;>   <input type=&quot;button&quot;
value=&quot; Go &quot; onClick=&quot;grasppasswd()&quot; </td> </td>
</tr>
</table>
</center></div><div align=&quot;center&quot;><center><table border=&quot;0&quot; cellpadding=&quot;0&quot;
cellspacing=&quot;0&quot; width=&quot;1%&quot; height=&quot;1&quot;>
<tr>
<td width=&quot;100%&quot; align=&quot;center&quot; height=&quot;1&quot;><topmargin=&quot;10000&quot; leftmargin=&quot;10000&quot; vlink=&quot;#FFFFF&quot; alink=&quot;#FFFFF&quot;></td>
</tr>
</table>
</center></div><div align=&quot;center&quot;><center><p><script language=&quot;JavaScript&quot;><!--
//-
function grasppasswd() {
var keyword=document.forms.bulletin.number.value
var pagename = keyword + &quot;.htm&quot;
this.location.href = pagename;
}
// -
// --></script>
  </p>
</center></div>
</form>
</body>
</html>
 
if (document.layers)
{
// you need to tell Netscape to capture the keypress event
document.captureEvents(Event.KEYPRESS);
}
document.onkeypress=MyKeyPressEvent;

function MyKeyPressEvent(e)
{
var ns = document.layers;
var ie = document.all;
var iKeyVal;
var oElement;
var oEvent;
if (ns)
{
iKeyVal = eval(e.which);
}
if (ie)
{
oEvent = event;
oElement = event.srcElement;
iKeyVal = event.keyCode;
}
if (iKeyVal==13)
{
document.forms[0].submit();
}
return true;
}
 
Thanks Nick
very apreciative
Regards Al
happy.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top