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 to the CF scene
    Join Date
    Jul 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript Problem |Wanna make a javascript amateur praise you for your smarts?|

    Alright basically what i want to do is write a code which detects a href location in a certain frame, then if this href is detected send the frame to a new location.
    I've tried countless variations of this script, but i just cant get it to work.

    So far...
    var quirksMode2 = "http://www.google.com.au/";
    var quirksmode = (frames['framea'].location.href);

    function count()
    {
    var quirksmode = (frames['framea'].location.href)
    if (quirksmode == quirksMode2)
    {frames['framea'].location.href = "http://www.hello.com.au"}
    else {frames['framea'].location.href = "http://www.ninemsn.com.au"};
    document.write('Hello')
    setTimeout("count()",1000)
    }
    Then i'd launch 'count()'.
    -------------------------------------------------------------------------
    Any ideas on fixing it up?

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Posts
    400
    Thanks
    0
    Thanked 0 Times in 0 Posts
    First, read section 2, of this page.

    Second, no. Security consideration prohibit reading the href (or any other properties) of a frame/window that isn't from the same domain.

  • #3
    Regular Coder
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    375
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Third: You keep doing that document.write every 1 second and your frameset should get overwritten in the user's browser if this script is in the head on the frameset page. Other odd effects will obtain if it is on some other page in the frameset, depending upon where in that page.

    Fourth: Why not just make framea's src be http://www.ninemsn.com.au to begin with?

  • #4
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    no.1: soz bout the name
    no.2: thats incorrect, you actually can i know because its another part of my script which does work
    no.3: the hello was just to c if it was working, for got to take it out
    no.4: i can't use the src because a php script is what sends the person to a page that would be a security risk and which i wish to redirect from
    no.5: and ofcourse I still can't get this thing to work anyone got any bright ideas?
    p.s. I might repost with a descriptive name.

  • #5
    Regular Coder
    Join Date
    Feb 2005
    Posts
    400
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by kevmeister
    no.2: thats incorrect, you actually can i know because its another part of my script which does work
    I would like to see that working part. If you do post it, please use code-tags.
    Last edited by Harry Armadillo; 07-06-2005 at 01:02 PM.


  •  

    Posting Permissions

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