HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 3rd, 2005, 10:13 PM
okl okl is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Location: Singapore
Posts: 359 okl User rank is Private First Class (20 - 50 Reputation Level)okl User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 2 h 24 m 16 sec
Reputation Power: 4
Send a message via MSN to okl
what is the function of the code?

<script language="javascript">
var isIE = document.all?true:false;
var isNS = document.layers?true:false;
function onlyDigits(e) {
var _ret = true;
if (isIE) {
if ((window.event.keyCode < 46 || window.event.keyCode > 57) && window.event.keyCode != 45) {
window.event.keyCode = 0;
_ret = false;
}
}
if (isNS) {
if (e.which < 46 || e.which > 57||e.which!=45){
e.which = 0;
_ret = false;
}
}
return (_ret);
}
</script>

Reply With Quote
  #2  
Old February 4th, 2005, 02:41 AM
Yeruhn's Avatar
Yeruhn Yeruhn is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Netherlands
Posts: 428 Yeruhn User rank is Sergeant (500 - 2000 Reputation Level)Yeruhn User rank is Sergeant (500 - 2000 Reputation Level)Yeruhn User rank is Sergeant (500 - 2000 Reputation Level)Yeruhn User rank is Sergeant (500 - 2000 Reputation Level)Yeruhn User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 16 h 35 m 27 sec
Reputation Power: 10
I guess the name says it all: it's been used to make sure one can only enter digits in an input box, like:
Code:
<input type=text onkeypress='return onlyDigits(event)'>

Reply With Quote
  #3  
Old February 4th, 2005, 07:55 AM
okl okl is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Location: Singapore
Posts: 359 okl User rank is Private First Class (20 - 50 Reputation Level)okl User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 2 h 24 m 16 sec
Reputation Power: 4
Send a message via MSN to okl
what about this?

Quote:
Originally Posted by Yeruhn
I guess the name says it all: it's been used to make sure one can only enter digits in an input box, like:
Code:
 <input type=text onkeypress='return onlyDigits(event)'>
 


what about this ??

<script language=JavaScript>
var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document. onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontext menu=clickIE;}

document.oncontextmenu=new Function("return false")
// -->
</script>

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > what is the function of the code?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT