View Single Post
Old 12-17-2003, 06:06 PM   PM User | #1
WillGibson
New Coder

 
Join Date: Dec 2003
Location: At work...still
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
WillGibson is an unknown quantity at this point
Internet Explorer A few more functions...

Another set of functions I have used to make my life easier.

By chance someone else will find use for them.

Once again I write for IE (4 to 6) as that is what I have to use.

PHP Code:

// used to cancel unwanted events, my most common use is
// <FORM onSubmit=fEventCancel() > as most time I don't let
// submits happen outside of code/script...WRG
function fEventCancel() {
   
event.returnValue=false;
}
// used to disable the backspace at the document level, like this:
// document.onkeydown = fKillBackspace;
function fKillBackspace() {
   
// Use onKeyDown="fOnKeyDo(8,'window.event.cancelBubble = true;')" 
   // on input fields that you wish the backspace key to work on...WRG
   
if (window.event && window.event.keyCode == 8) { // try to cancel the backspace
      
window.event.cancelBubble true;
      
window.event.returnValue false;
      return 
false;
   }
}
function 
fSetAsNextTab(element) {
   
// Use as the onBlur action...WRG
   
element.focus();
}

function 
fPopCenterWindow(strURLstrWindowNameintWinHintWinWboolIEModalD){
   
// Basic Centered Popup window...WRG
   
var intLeftPos = (screen.width) ? (screen.width-intWinW)/0
   
var intTopPos = (screen.height) ? (screen.height-intWinH)/0
   
if ((boolIEModalD) && (window.showModalDialog)) {
      var 
newWindow window.showModalDialog(strURLwindow'dialogHeight:'+intWinH+'px;dialogWidth:'+intWinW+'px;center:yes;help:no;resizable:no;status:no');
   } else {
      var 
newWindow window.open(strURLstrWindowName'height='+intWinH+',width='+intWinW+',top='+intTopPos+',left='+intLeftPos+',toolbar=no,minimize=no,status=no,memubar=no,location=no,scrollbars=yes')
   }
}
function 
fOnKeyDo(intKey,strDo){
   
// Do action when key is pressed...WRG
   
var keyCode event.keyCode
   
if (keyCode == intKey) {
      eval(
strDo);
   }
}
// Used in a frame to return a form object from that frameset's opener document object
function fOpenerWindowForm(boolIEModalD,strForm){
   if ((
boolIEModalD) && (window.showModalDialog)) {
      if ((
parent.window.dialogArguments) && (eval("parent.window.dialogArguments."+strForm))) {
         return 
parent.window.dialogArguments;
      }else{
         return 
parent.opener// replace with top.opener if needed
      
}
   }else{
      return 
parent.opener// replace with top.opener if needed
   
}
}
// Used in a frame to return that frameset's opener document object
function fOpenerWindow(boolIEModalD){
   if ((
boolIEModalD) && (window.showModalDialog)) {
      if (
parent.window.dialogArguments) {
         return 
parent.window.dialogArguments;
      }else{
         return 
parent.opener;// replace with top.opener if needed
      
}
   }else{
      return 
parent.opener;// replace with top.opener if needed
   
}
}
// Hide an object
function fHideObj(Obj) {
   if (
Obj.style.display != "none") {
      
Obj.style.display "none";
   }
}
// Unhide an object
function fUnHideObj(Obj) {
   if (
Obj.style.display != "") {
      
Obj.style.display "";
   }

__________________
Why?
Ok, but Why?

Last edited by WillGibson; 12-17-2003 at 09:00 PM..
WillGibson is offline   Reply With Quote