PDA

View Full Version : Change app from firefox to IE gives errors



mulita
Mar 21st, 2007, 09:13 AM
I recently got an app that ran only in firefox and not in IE. I am trying to change it to an IE app.

I have changed most of the code but still get errors. For example I have the script containing the function loadRequired() fine but calling it in

<body onload="loadRequired();">

gives me an object expected error even though the function in the script requires no object to be embedded.

please help.

Mulita

Kor
Mar 21st, 2007, 12:16 PM
we have to see the code.
Anyway, it is better to separate the presentation from the functionality


<script type="text/javascript">
......some code....
window.onload=loadRequired;
</script>

instead of

<body onload="loadRequired();">

SSJ
Mar 21st, 2007, 12:36 PM
Can I see the code inside the loadRequired() function?

mulita
Mar 27th, 2007, 03:02 PM
Here is the code for the loadRequired() function:

function loadRequired(){
var firstFocus;
var formObject;
var elementObject;
var imageRequired;
firstFocus=-1;
for(i=0;i<document.forms.length;i++){
formObject=document.forms[i];
for(c=0;c<formObject.elements.length;c++){
elementObject=formObject.elements[c];
if(elementObject.className=='required'){
elementObject.setAttribute('onChange','validateRequired(this)');
imageRequired=document.createElement('img');
imageRequired.className='required';
elementObject.parentNode.insertBefore(imageRequired, elementObject);
}
else if(elementObject.className=='requiredor'){
elementObject.setAttribute('onChange','validateRequiredOr(this)');
imageRequired=document.createElement('img');
imageRequired.className='required';
elementObject.parentNode.insertBefore(imageRequired, elementObject);
}

if(elementObject.getAttribute('tabindex')=='1' & firstFocus=='-1'){
firstFocus=c;
}
if(elementObject.getAttribute('type')=='date'){
var inputId=elementObject.getAttribute('id');
Calendar.setup({
inputField : inputId,
ifFormat : "%Y-%m-%d",
button : "calendar-"+inputId
});

}
}
}
/*load the first tiny-tab (if there is one)*/
if(document.all['current-tinytab']){
tinyTabs(document.all["current-tinytab"]);
}

/*prepares the span elements with title attributes for qtip*/
tooltip.init();

/*prepares a sidtable if it is present*/
if(document.all["sidtable"]){
sidtableInit();
}

/*give focus to the tab=1 form element if this is a form*/
/*should always be last!*/
if(i>0){
if(firstFocus==-1){firstFocus=0;}
if(document.forms[0].elements[firstFocus]){
document.forms[0].elements[firstFocus].focus();
}
}
}