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 5 of 5
  1. #1
    New Coder
    Join Date
    Sep 2004
    Posts
    43
    Thanks
    4
    Thanked 0 Times in 0 Posts

    href="#" returns error on page in IE6

    I am trying to make a link that will call a function which opens a sized window with a html doc in it. My code works for Firefox and Safari, but not IE6. Take a look and let me know what you think. Thanks.

    function Open_Win()
    {
    window.open("http://www.crosst.org/Touching-God-Fast.html","Touching God Fast","scrollbars=yes, statusbar=yes, height=500, width=850");
    }


    <a href="#" onClick="JavaScript:Open_Win();"><image>

  • #2
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,707
    Thanks
    0
    Thanked 237 Times in 232 Posts
    Hi there svoltmer,

    IE does not accept this...
    Touching God Fast
    ...so change it to this...
    Touching_God_Fast
    ...or to this...
    TouchingGodFast
    coothead

  • #3
    New Coder
    Join Date
    Sep 2004
    Posts
    43
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Thanks!!

    I didn't even think about the spaces on the title being a problem.
    Huge help!!

    Also.. which is more approprate, window.open or document.open? Thanks Again.

  • #4
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,707
    Thanks
    0
    Thanked 237 Times in 232 Posts
    Hi there svoltmer,

    window.open is appropriate.
    Note that your method will not work for those with javascript disabled, they will see nothing and, consequently, carry on eating.
    This method will prevent that...
    Code:
    
    <script type="text/javascript">
      var mywindow;
      var features='scrollbars=yes,statusbar=yes,height=500,width=850';
    window.onload=function() {
    document.getElementById('touch').onclick=function() {
       Open_Win(this.href);
       return false;
      }
     }
    function Open_Win(url){
       mywindow=window.open(url,'TouchingGodFast',features);
       mywindow.focus();
     }
    </script>
    
    <a id="touch" href="http://www.crosst.org/Touching-God-Fast.html">
    <img src="http://www.crosst.org/images/Touching-God-Fast.jpg" alt=""/>
    </a>
    
    coothead

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    window.open opens a new window.
    document.open creates a new document replacing the current document, and opens it for parsing.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

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