IE-Compatible JavaScript Not Working In IE?
Posted: Sat Jan 14, 2006 6:56 pm
I have just created this code for InvisionFree that creates a new section of the Compose PM screen if the member is trying to PM the administrator.
Everything used in the script should be IE-compatible, yet although the script works fine in NetScape, it causes an "Unknown Runtime Error" in IE.
Here is the script:
Can anyone please help me pinpoint the line(s) that is/are causing the error, since "unknown runtime error" doesn't give me much help?
BTW, all of the functions used there are documented on MSDN as IE-Compatible, AFAIK....
-IMP

Everything used in the script should be IE-compatible, yet although the script works fine in NetScape, it causes an "Unknown Runtime Error" in IE.
Here is the script:
Code: Select all
<script language="JavaScript" type="text/JavaScript">
function SetPMName() {
if (document.REPLIER.from_contact) { document.REPLIER.entered_name.value=document.REPLIER.from_contact.options[document.REPLIER.from_contact.selectedIndex].text; }
ShowOptions();
}
function CheckOpts() {
if (mytr.style.display!="none") {
document.REPLIER.msg_title.value=document.REPLIER.adminopts.options[document.REPLIER.adminopts.selectedIndex].text+": "+document.REPLIER.msg_title.value;
}
return true;
}
function ShowOptions() {
namer="IceMetalPunk";
if (document.REPLIER.entered_name.value.toLowerCase()==namer.toLowerCase()) { okay=""; } else { okay="none"; }
mytr.style.display=okay;
mytr2.style.display=okay;
}
if (window.location.href.toLowerCase().indexOf("act=msg")!=-1) {
trs=document.getElementsByTagName("tr");
for (p=0; p<trs.length; p++) {
if (trs[p].innerHTML.toLowerCase().indexOf("enter your message")!=-1 && trs[p+1].innerHTML.toLowerCase().indexOf("message title")!=-1) {
mytr=trs[p+2].parentNode.insertRow(trs[p+2].rowIndex);
mytr2=trs[p+3].parentNode.insertRow(trs[p+3].rowIndex);
mytr.innerHTML="<td colspan='2' class='pformstrip'>Administrator PM Options</td>";
mytr2.innerHTML="<td class='pformleft'><b>Select Purpose of PM</b></td><td class='pformright'><select name='adminopts'><option>Other</option><option>Personal PM</option><option>Board PM</option><option>Forum Bug</option><option>Board Skin</option></select></td>";
mytr.style.display="none";
mytr2.style.display="none";
}
}
if (document.REPLIER.from_contact) { document.REPLIER.from_contact.setAttribute("onChange","SetPMName()"); }
document.REPLIER.entered_name.setAttribute("onBlur","ShowOptions()");
document.REPLIER.setAttribute("onSubmit","return CheckOpts()");
SetPMName();
}
</script>BTW, all of the functions used there are documented on MSDN as IE-Compatible, AFAIK....
-IMP