...

View Full Version : Popup (Error on page) in IE 7



lausac
02-26-2007, 11:14 AM
Hi I am a newbie, and I would apreciate any help that you can give me on the following problem.
I am trying to create a popup window for a friends new website, that pops up showing another html page, but is resized. I struggled to find a script that would do this and not be blocked by Internet Explorer 7.

I used the code below (which works fine in Mozilla) but creates an (error on page) message at the foot of the explorer window, when opened in IE7.

Here is the code


<script type="text/javascript" src="lib.js"></script>
<script type="text/javascript" src="popup.js"></script>
<script type="text/javascript" >

// redefining default features
var _POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,width=400,height=600,right=500,top=500';

listen('load', window, function() {
listen('click', 'popup-listen', event_popup );
listen('click', 'popup-feat' , event_popup_features('location=0,statusbar=1,menubar=1,width=190,height=300') );
mlisten('click', getElementsByClass('popup','a'), event_popup );
});

</script>

Here is the Link to the popup window

<p><a href="popupex.html" class="link3" onclick="raw_popup('popupex.html');return false">More Details</a></p></div>

I would be extremely grateful of any help that you can give.

Thanks

glenngv
02-26-2007, 03:29 PM
What error message is thrown by IE7? Double-click that ! icon in the address bar to see the error message.

Arty Effem
02-26-2007, 06:32 PM
Hi I am a newbie, and I would apreciate any help that you can give me on the following problem.
I am trying to create a popup window for a friends new website, that pops up showing another html page, but is resized. I struggled to find a script that would do this and not be blocked by Internet Explorer 7.

I used the code below (which works fine in Mozilla) but creates an (error on page) message at the foot of the explorer window, when opened in IE7.
I.E. does not accept hyphens in window names. Try changing them to underscores.

lausac
02-26-2007, 09:05 PM
I'm sorry I may have misled you guys, when I clicked on the error icon it said something like " error in line 161" Throw out and catch error.
(i'm at work and don't have access to the script)

After checking the html page, I figured out that the error must be in the
linked lib.js script

Should I put that script up to show you?

lausac
02-28-2007, 11:22 AM
Hi
This is the error at the bottom left of the browser:
Line 161
Char 30
Error Exception Thrown and not caught

========================================================
and here is the code from that part of the lib.js script

// DOM

function getElem(elem) {
if (document.getElementById) {
if (typeof elem == "string") {
elem = document.getElementById(elem);
if (elem===null) throw 'cannot get element: element does not exist';
} else if (typeof elem != "object") {
throw 'cannot get element: invalid datatype';
}
} else throw 'cannot get element: unsupported DOM';
return elem;
}

function hasClass(elem, className) {
return getElem(elem).className.split(' ').has(className);
}

function getElementsByClass(className, tagName, parentNode) {
parentNode = !isUndefined(parentNode)? getElem(parentNode) : document;
if (isUndefined(tagName)) tagName = '*';
return filter(parentNode.getElementsByTagName(tagName),
function(elem) { return hasClass(elem, className) });
}


// DOM EVENTS

Is this enough information for you gguys to help?

Thanks

glenngv
02-28-2007, 03:24 PM
When you call getElem() function, you should have a catch block because you do a throw in that function.

function func(id){
var el;
try {
el = getElem(id);
}
catch(e){
alert(e.message);
return;
}
}

lausac
02-28-2007, 05:13 PM
Thanks Glenn for your help, as I have said earlier I am a total newbie when it comes to Javascript, where would I put the above code in the lib.js file?

Thanks

glenngv
02-28-2007, 10:01 PM
That is not the exact script. I just showed you a sample of a try-catch block. Wherever you are calling the getElem() function, you need to put it inside a "try" block and add a "catch" block to catch possible error.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum