Results 1 to 4 of 4

Thread: js help

  1. #1
    Join Date
    Jan 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question js help

    Ok I downloaded a script from DD (http://www.dynamicdrive.com/dynamici...mlprogress.htm changed it so that at the end of the 5 seconds it would just forward the user to the clans forums and it WORKS! But I have a problem, with how it works. It loads the forums in the frame of the clan page

    this is what I have
    Code:
    var action=function()
    {
    window.open="www.theforums.com";
    }
    how do I get it to load the page outside the frames? I don't wanna use "window.open" because of pop-up blockers and such I just want it to forward the user. Any Help would be appreciated
    Last edited by paynerd; 01-03-2006 at 05:10 PM. Reason: edited code

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    var action=function()
    {
    parent.location = "http://www.theforums.com/";
    }
    By the by, window.open() is a function, not a variable (although the boundaries are a little blurred in Javascript; the above code won't [I think] produce an error, but neither will it produce the effect desired). You should call it with window.open("url"), not window.open = url.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jan 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    WOO HOO!!! Thank You Twey it worked great in both IE6 and Firefox (test other later)
    and it works exactly the way I wanted it to.

    Thank you So much
    Paynerd

  4. #4
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    By the by, window.open() is a function, not a variable [...]
    It's both. All variables, functions declarations, and formal arguments are properties of some object so they can be assigned to just like properties of a user-defined object[1]. For example:

    Code:
    function myFunction() {}
    
    alert(typeof myFunction);  /* function */
    
    myFunction = 'value';
    
    alert(typeof myFunction);  /* string */
    The open property is just a reference to a host function. Some third-party pop-up blockers operate by assigning their own function to that same property, replacing its functionality.

    Mike


    [1] There are exceptions. Some built-in properties are read-only where an assignment will be ignored, and host objects are free to act however they like (IE is known to throw exceptions when assigning to some host objects).

Bookmarks

Posting Permissions

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