+ Reply to Thread
Results 1 to 1 of 1

Thread: JavaScript: document.iframe.link.click() ?

  1. #1
    Scoochi2's Avatar
    Scoochi2 is offline x10 Sophmore Scoochi2 is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    Southport!
    Posts
    185

    JavaScript: document.iframe.link.click() ?

    Hey, I'm trying to get JS to simulate a link click in an iframe on my page. Normally I would just change the src of the iframe, but the link I need to click contains a code that is different each time, and will not work with a different (or no) code.

    I have this:
    HTML Code:
    <iframe width='600' height='400' id='iframe' name='iframe' src='page.php'></iframe>
    and my JS thus far is this:
    Code:
    document.getElementById('iframe').links[25].click();
    However, that gives the error:
    Error: document.getElementById("iframe").links is undefined
    Source File: http://localhost/codeswitcher
    Line: 49
    I have tried using document.iframe.links... as well but get a similar result.

    Does anyone know where I'm going wrong or have a better way to 'click' that link? Manually clicking the link is out of the question, as this script will be run many times in succession and I don't want to stay up all night .

    I've also tried using the following.
    Code:
    frames['iframe'].document.links[25].click();
    However, that gives the error: "Permission denied to get property Window.document".

    EDIT: I now realise that I cannot do this due to the iframe containing a site from a different domain to my own. This is an entirely different problem
    Last edited by Scoochi2; 11-28-2008 at 01:19 PM.
    If anyone can see it, my post was meant for anyone who reads it. Don't take it personally or think I'm being condescending... :nuts:

+ Reply to Thread

Similar Threads

  1. Making a site JavaScript dependent - pros/cons?
    By Tarzan in forum Programming Help
    Replies: 8
    Last Post: 07-11-2008, 10:08 AM
  2. drop down menus with JavaScript disabled?
    By sifaka in forum Free Hosting
    Replies: 1
    Last Post: 05-15-2008, 10:46 AM
  3. javascript and external javascript files problem
    By delon in forum Programming Help
    Replies: 6
    Last Post: 04-27-2008, 12:41 AM
  4. XML and Javascript
    By cuteboytm in forum Graphics & Webdesign
    Replies: 1
    Last Post: 09-21-2007, 10:00 AM
  5. Some nice-simple JavaScript effects !!
    By careerbridge in forum Scripts & 3rd Party Apps
    Replies: 1
    Last Post: 07-13-2006, 08:36 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers