- Jan 14, 2013
- 23
- 0
- 0
So I have a page that has tabs, and I want to disable enter on one of the subpages. I have a javascript function that'll do it, but it doesn't get seen if I put it in the subpage. I needed to move it to the main page to get it to work, but I specifically don't want it disabling one of the other subpages. I assume there's some way to distinguish which page I'm on, but I suck with javascript and don't know where to begin.
searchform.jspf and editserver.jsp are the two subpages if that helps. Any help appreciated ^.^
Code:
In main JSP (search.jsp):
[COLOR=black]<script>[/COLOR]
[COLOR=black] document.onkeypress = stopRkey[/COLOR]
[COLOR=black]</script>[/COLOR]
[COLOR=black]in JS File:[/COLOR]
[COLOR=black]function stopRkey(evt) {[/COLOR]
[COLOR=black] var evt = (evt) ? evt : ((evt.srcElement) ? evt.srcElement : null);[/COLOR]
[COLOR=black] var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);[/COLOR]
[COLOR=black] if (( evt.keyCode == 13) && (node.type == "text")){[/COLOR]
[COLOR=black] return false;[/COLOR]
[COLOR=black] }[/COLOR]
[COLOR=black]}[/COLOR]
