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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    New Coder
    Join Date
    Apr 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Open window in new window but with no menu etc at the top

    Hello, I have the below code in a webpage to open a link in a new window but I get an error on line 9 Char 2 - 'Null' is null or not an object. Anyone any ideas? the code works on another page!

    <HTML><HEAD><TITLE>VE</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
    <!--
    function openBrWindow(theURL,winName,features)
    {
    window.open(theURL,winName,features);
    }
    -->
    </script>

    <SCRIPT src="../VE%20-%20Home_files/library.js"
    type=text/javascript></SCRIPT>

    <SCRIPT src="../VE%20-%20Home_files/main.js"
    type=text/javascript></SCRIPT>
    <LINK href="../Victoria%20Electricity%20-%20Home_files/style.css" type=text/css
    rel=stylesheet><LINK href="../icon.gif" type=image/gif rel=icon>
    <META content="MSHTML 6.00.2900.2604" name=GENERATOR><style type="text/css">
    <!--
    body {
    margin-top: 2px;
    }
    -->
    </style></HEAD>
    <BODY>
    <DIV class=centered>
    <TABLE id=content>
    <TBODY>
    <TR>
    <TD height="50" id=contentRight><p><strong>Direct Connect</strong></p>
    <p><a href="Sales_Form.htm"onclick="openBrWindow('Sales_Form.htm','Sales Move in Move Out Form','status=0,scrollbars=1,resizable=1,width=400,height=300');return false" target="_blank">Move In Move Out Form</a></p>
    </TD>
    </TR>
    </TBODY></TABLE>
    <TABLE id=footer>
    <TBODY>
    <TR>
    <TD>Copyright © 2005 VE</TD>
    </TR></TBODY></TABLE></DIV>
    <SCRIPT language=JavaScript>
    <!--
    var SymRealOnLoad;
    var SymRealOnUnload;

    function SymOnUnload()
    {
    window.open = SymWinOpen;
    if(SymRealOnUnload != null)
    SymRealOnUnload();
    }

    function SymOnLoad()
    {
    if(SymRealOnLoad != null)
    SymRealOnLoad();
    window.open = SymRealWinOpen;
    SymRealOnUnload = window.onunload;
    window.onunload = SymOnUnload;
    }

    SymRealOnLoad = window.onload;
    window.onload = SymOnLoad;

    //-->
    </SCRIPT>
    </BODY></HTML>


    Any help is appreciated, thanks

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts

    This may or may not be exactly what the error is complaining about but...

    Spaces or other special characters are not allowed in window target. Remove the spaces or use underscore.
    Code:
    openBrWindow('Sales_Form.htm','Sales_Move_in Move_Out_Form','...');
    You can also simplify it by passing this.href in the first parameter.
    Code:
    <a href="Sales_Form.htm" onclick="openBrWindow(this.href,...);
    Modify the function as well so that the popup receives focus when it is opened.
    Code:
    function openBrWindow(theURL,winName,features)
    {
       var win=window.open(theURL,winName,features);
       win.focus();
    }
    Try that and see how it goes.
    Last edited by glenngv; 05-23-2005 at 01:16 PM.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    Apr 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Still no go :(

    I made all those amendments but still get the same null error, I get this when I load the page straight away but when i click on the link I get a different error: -

    Line: 9 Char: 4 Error: Invalid Argument

    Any other ideas?

    Thanks in advance.

  • #4
    New Coder
    Join Date
    Apr 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation and

    Line 9 is :-

    var win=window.open(theURL,winName,features);

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Only reason I can think of why your code doesn't work is because of this bit here
    Code:
    <SCRIPT language=JavaScript>
    <!--
    var SymRealOnLoad;
    var SymRealOnUnload;
    
    function SymOnUnload()
    {
    window.open = SymWinOpen;
    if(SymRealOnUnload != null)
    SymRealOnUnload();
    }
    
    function SymOnLoad()
    {
    if(SymRealOnLoad != null)
    SymRealOnLoad();
    window.open = SymRealWinOpen;
    SymRealOnUnload = window.onunload;
    window.onunload = SymOnUnload;
    }
    
    SymRealOnLoad = window.onload;
    window.onload = SymOnLoad;
    
    //-->
    </SCRIPT>
    That comes from Norton Internet Security. If its in your current page, take it out and then resave it. It should work then.

  • #6
    New Coder
    Join Date
    Apr 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Done that, still no bananas

    My code now looks like this but I get the same errors, this one when I load the page 'line 9 Char 2 - 'Null' is null or not an object' and this one when I click the link 'Line: 9 Char: 4 Error: Invalid Argument'.

    Code below, how to I indent the code like you guys are lol: -

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
    <!---->
    <HTML><HEAD><TITLE>VE - Home</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
    <!--
    function openBrWindow(theURL,winName,features)
    {
    var win=window.open(theURL,winName,features);
    win.focus();
    }
    -->
    </script>

    <SCRIPT src="../VE%20-%20Home_files/library.js"
    type=text/javascript></SCRIPT>

    <SCRIPT src="../VE%20-%20Home_files/main.js"
    type=text/javascript></SCRIPT>
    <LINK href="../VE%20-%20Home_files/style.css" type=text/css
    rel=stylesheet><LINK href="../icon.gif" type=image/gif rel=icon>
    <META content="MSHTML 6.00.2900.2604" name=GENERATOR><style type="text/css">
    <!--
    body {
    margin-top: 2px;
    }
    -->
    </style></HEAD>
    <BODY>
    <DIV class=centered>
    <TABLE id=content>
    <TBODY>
    <TR>
    <TD height="50" id=contentRight><p><strong>Direct Connect</strong></p>
    <p><a href="Sales_Form.htm"onclick="openBrWindow(this.href,'Sales_Move_in Move_Out_Form','status=0,scrollbars=1,resizable=1,width=400,height=300');return false" target="_blank">Move In Move Out Form</a></p>
    </TD>
    </TR>
    </TBODY></TABLE>
    <TABLE id=footer>
    <TBODY>
    <TR>
    <TD>Copyright © 2005 VE Pty Ltd</TD>
    </TR></TBODY></TABLE></DIV>
    </BODY></HTML>

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    The error might be coming from these:

    <SCRIPT src="../VE%20-%20Home_files/library.js"
    type=text/javascript></SCRIPT>

    <SCRIPT src="../VE%20-%20Home_files/main.js"
    type=text/javascript></SCRIPT>

    Try running your page in Firefox to get more detailed error messages.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #8
    New Coder
    Join Date
    Apr 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question umm strange

    Works fine in firefox!! problem is my entire company is IE6 and I can't change this!

    How can I fix this or debug it further?

  • #9
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    What is in these scripts?
    Code:
    <SCRIPT src="../VE%20-%20Home_files/library.js"
    type=text/javascript></SCRIPT>
    
    <SCRIPT src="../VE%20-%20Home_files/main.js"
    type=text/javascript></SCRIPT>

  • #10
    New Coder
    Join Date
    Apr 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow library.js

    function e(id) {
    return document.getElementById(id);
    }

    function hasClass(element,className) {
    classes = element.className.split(' ');
    for (var i = 0; i < classes.length; i++) if (classes[i] == className) return true;
    return false;
    }

    function addClass(element,className) {
    classes = element.className.split(' ');
    for (var i = 0; i < classes.length; i++) if (classes[i] == className) break;
    classes[i] = className;
    element.className = classes.join(' ');
    }

    function removeClass(element,className) {
    classes = element.className.split(' ');
    for (var i = 0; i < classes.length; i++) if (classes[i] == className) break;
    classes[i] = null;
    element.className = classes.join(' ');
    }

    function switchClass(element,className,classNameNew) {
    classes = element.className.split(' ');
    for (var i = 0; i < classes.length; i++) if (classes[i] == className) break;
    if (i < classes.length) classes[i] = classNameNew;
    element.className = classes.join(' ');
    }

    function getX(element) {
    if (element.x) return element.x;
    if (element.offsetParent) {
    for (var x = 0; element.offsetParent; element = element.offsetParent) x += element.offsetLeft;
    x += document.body.offsetLeft;
    return x;
    }
    else return false;
    }

    function getY(element) {
    if (element.y) return element.y;
    if (element.offsetParent) {
    for (var y = 0; element.offsetParent; element = element.offsetParent) y += element.offsetTop;
    y += document.body.offsetTop;
    return y;
    }
    else return false;
    }

  • #11
    New Coder
    Join Date
    Apr 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow main.js

    function initialise() {
    navigationCurrent = null;
    navigationTimeout = null;
    initialiseNavigation();
    }

    function initialiseNavigation() {
    n = e('navigation').getElementsByTagName('a');
    for (var i = 0; i < n.length; i++) {
    if (n[i].childrenNavigation = e('nc' + n[i].id.substring(1))) {
    n[i].x = getX(n[i]);
    n[i].y = getY(n[i]);
    if (!i) n[i].y++; // move top item down 1 more pixel for neatness
    n[i].childrenNavigation.style.left = (n[i].x + 240) + 'px'; // navigation block is 240px wide
    n[i].childrenNavigation.style.top = (n[i].y - 1) + 'px';
    addClass(n[i],'arrow1');
    nc = n[i].childrenNavigation.getElementsByTagName('a');
    for (var j = 0; j < nc.length; j++) {
    nc[j].nID = n[i].id;
    nc[j].onmouseover = navigationChildMouseover;
    nc[j].onmouseout = navigationChildMouseout;
    }
    }
    n[i].onmouseover = navigationMouseover;
    n[i].onmouseout = navigationMouseout;
    }
    }

    function navigationMouseover() {
    if (navigationTimeout) clearTimeout(navigationTimeout);
    if (navigationCurrent) navigationDeactivate(navigationCurrent);
    navigationActivate(this.id);
    }

    function navigationMouseout() {
    navigationTimeout = setTimeout('navigationDeactivate(\'' + this.id + '\')',5);
    }

    function navigationChildMouseover() {
    if (navigationTimeout) clearTimeout(navigationTimeout);
    navigationActivate(this.nID);
    addClass(this,'highlight');
    }

    function navigationChildMouseout() {
    removeClass(this,'highlight');
    navigationTimeout = setTimeout('navigationDeactivate(\'' + this.nID + '\')',500);
    }

    function navigationActivate(navigationID) {
    navigationCurrent = navigationID;
    n = e(navigationID);
    addClass(n,'highlight');
    switchClass(n,'arrow1','arrow2');
    if (n.childrenNavigation) n.childrenNavigation.style.visibility = 'visible';
    }

    function navigationDeactivate(navigationID) {
    navigationCurrent = null;
    n = e(navigationID);
    removeClass(n,'highlight');
    switchClass(n,'arrow2','arrow1');
    if (n.childrenNavigation) n.childrenNavigation.style.visibility = 'hidden';
    }

    window.onload = initialise;

  • #12
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Quote Originally Posted by ziguana_man
    onclick="openBrWindow(this.href,'Sales_Move_in Move_Out_Form',...)
    You still had a space in the window target. That still causes the invalid argument error.

    Regarding the null object error, try temporarily removing the library.js and main.js from the page to verify if the error is caused by those scripts.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #13
    New Coder
    Join Date
    Apr 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Nearly there

    I removed the .js files and the error no longer comes up when I load the page but when I click the link I get Line 9 Char 4 Error Access is denided.

    The line is: -

    var win=window.open(theURL,winName,features);

  • #14
    Regular Coder
    Join Date
    Feb 2005
    Posts
    400
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In main.js, the line

    n = e('navigation').getElementsByTagName('a');

    is looking for an element id'ed as 'navigation', and your page doesn't have one.

  • #15
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Quote Originally Posted by ziguana_man
    I removed the .js files and the error no longer comes up when I load the page but when I click the link I get Line 9 Char 4 Error Access is denided.

    The line is: -

    var win=window.open(theURL,winName,features);
    Can you post a link to a sample or demo page so that we're testing the same page?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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