CopyPastor

Detecting plagiarism made easy.

Score: 0.8695771433354177; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2019-07-05
by Turing1729

Original Post

Original - Posted on 2009-01-22
by geowa4



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Use this DOM
<input type='text' onkeypress='validate(evt)' />
And below is the script
function validate(evt) { var theEvent = evt || window.event; // Handle paste if (theEvent.type === 'paste') { key = event.clipboardData.getData('text/plain'); } else { // Handle key press var key = theEvent.keyCode || theEvent.which; key = String.fromCharCode(key); } var regex = /[0-9]|/; if( !regex.test(key) ) { theEvent.returnValue = false; if(theEvent.preventDefault) theEvent.preventDefault(); } }
Use this DOM
<input type='text' onkeypress='validate(event)' />
And this script
function validate(evt) { var theEvent = evt || window.event;
// Handle paste if (theEvent.type === 'paste') { key = event.clipboardData.getData('text/plain'); } else { // Handle key press var key = theEvent.keyCode || theEvent.which; key = String.fromCharCode(key); } var regex = /[0-9]|\./; if( !regex.test(key) ) { theEvent.returnValue = false; if(theEvent.preventDefault) theEvent.preventDefault(); } }


        
Present in both answers; Present only in the new answer; Present only in the old answer;