| Title | WikiWizard JavaScript Internet Expolrer addEventListener |
| Date | 30-Mar-2007 11:05:14 EEST |
| Version | 2.4.100 |
| Submitter | 213.61.68.130 |
| Bug criticality | LightBug |
| Browser version | Internet Exporer 6 |
| Bug status | NewBug |
| PageProvider used | |
| Servlet Container | Tomcat |
| Operating System | Windows |
| URL | |
| Java version | 1.5 |
IE5/6 (7 unknown) does not support dom-function: document.addEventListener(event, function, param); properply - which is used in wikiwizard-jspwiki.js at line 6.
try following instead:
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', changeWidth, null);
} else if (document.attachEvent) {
document.attachEvent('DOMContentLoaded', changeWidth);
} else {
document.DOMContentLoaded = changeWidth;
}
- last else-block of this example should be checked
here is a more flexible solution with IE-onload bugfix
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', changeWidth, null);
} else if (document.attachEvent) {
if (!ie) document.attachEvent('DOMContentLoaded', changeWidth);
else {
var orgonload = window.onload;
if (typeof window.onload != 'function') window.onload = changeWidth;
else window.onload = function() {
orgonload();
changeWidth();
}
alert("ie event");
}
}
.. and so you can add changeWidth-Functio for IE
...
var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if (typeof( document.body.clientWidth ) == 'number') {
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
if ( browser == "Netscape Navigator" || browser == "Opera")
{
document.getElementById("editarea").setAttribute("style","height:" + myHeight * .70 + "px");
document.getElementById("WikiWizard").setAttribute("height","100%");
} else if (browser == "Internet Explorer") {
document.getElementById("editarea").style.height = (myHeight * .70) + "px"
document.getElementById("WikiWizard").style.height = "100%";
}
--MBB, 30-Mar-2007
sorry for "alert("ie event");" - forgot to remove
--MBB, 30-Mar-2007