Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Popup (Error on page) in IE 7

    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

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    What error message is thrown by IE7? Double-click that ! icon in the address bar to see the error message.

  • #3
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by lausac View Post
    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.

  • #4
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #5
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    When you call getElem() function, you should have a catch block because you do a throw in that function.
    Code:
    function func(id){
      var el;
      try {
         el = getElem(id);
      }
      catch(e){
         alert(e.message);
         return;
      }
    }

  • #7
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #8
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •