Skip to content

Instantly share code, notes, and snippets.

@miwebguy
Last active December 16, 2015 03:39
Show Gist options
  • Select an option

  • Save miwebguy/5371650 to your computer and use it in GitHub Desktop.

Select an option

Save miwebguy/5371650 to your computer and use it in GitHub Desktop.
JSHints
//scroll id into view
bpid = ${processId};
if(bpid) {
var divid = document.getElementById('${processId}');
divid.scrollIntoView(true);
}
// TEST INPUT
var numbersOnly = /^\d+$/;
var decimalOnly = /^\s*-?[1-9]\d*(\.\d{1,2})?\s*$/;
var uppercaseOnly = /^[A-Z]+$/;
var lowercaseOnly = /^[a-z]+$/;
var stringOnly = /^[A-Za-z0-9]+$/;
function testInputData(myfield, restrictionType) {
var myData = document.getElementById(myfield).value;
if(myData!==''){
if(restrictionType.test(myData)){
alert('It is GOOD!');
}else{
alert('Your data input is invalid!');
}
}else{
alert('Please enter data!');
}
return;
}
<input type="button" value="Test"
onclick="Javascript:testInputData('input1',numbersOnly)" />
// Old School Pop-ups
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
<button
onclick="NewWindow('/ProjectDocs/getObject/' + '88909439' + '/' + '16','name','400','400','yes');return false;"
>W2</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment