www.webdeveloper.com
Results 1 to 5 of 5

Thread: accessing forms which have no names set

  1. #1
    Join Date
    Sep 2007
    Posts
    4

    Unhappy accessing forms which have no names set

    Hi everyone,

    I have come up against a brick wall at the moment. When you have a form with submit buttons and text fields i know using javascript you can access these elements, but you require the name of the form to be set.

    Is there any way to do this when the form has no name set!!!

  2. #2
    Join Date
    Aug 2007
    Location
    Apartment
    Posts
    175

  3. #3
    Join Date
    Sep 2007
    Posts
    4
    mmm, had a look but cant seem to get that method to work with that i am doing..

    Basically i have a form in a file called "iframe.html" in this form i have text fields and also a submit box.

    in the main.html i am displaying "iframe.html" as a inline frame, and trying to grabe value and also for a submit request.



    PHP Code:
    document.iframe1.form1.submit() 
    This would automatically submit the form for me, on the inline frame, but without the form having a name i cant do it.

  4. #4
    Join Date
    Sep 2007
    Posts
    4
    here is the 2 files i am running..


    iframe.php
    PHP Code:
    <form action="" method="get">
    <input name="name" type="text" value="neil">
    <input name="" type="submit">
    </form>
    <? echo $name?>
    main.php
    PHP Code:
    <body onLoad="document.iframe1.submit()">
    <
    P ALIGN=center><IFRAME name="iframe1" SRC="iframe.php" WIDTH=300 HEIGHT=100></IFRAME></P
    What i am trying to do is get the main.php to activate the submit button on the inline frame (iframe.php) if i give the form a name it works, but with out the name set it wont.

  5. #5
    Join Date
    Sep 2007
    Posts
    4
    just when i think i am closer...

    i am able to do it now with the following

    PHP Code:
    <body onLoad="window.iframe1.document.forms[0].submit();"
    however i am now getting a javascript error "access denied" i am trying to open another websites page, which has a vote button and trying to auto click it.

    is there anyway to get around a Access Denied error?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles