Send Javascript submit to a different frame

Discussion in 'Javascript' started by michael.friis@gmail.com, Jan 19, 2006.

  1. Guest

    Im currently trying to build a simple extension to a website allowing
    me ot have a list of users in a frame beside the actual site.
    Problem is the actual website uses javascript to update the contents of
    dynamic pages so a link to a user on the website is:
    javascript:SubmitMain("/traveller.asp","u~14756|flag~14756")
    So what i did to make the userlist is make a simple framesite with one
    column for the userlist and one big coloumn for the website.
    What im trying to do is to make the links in the userlist frame
    (containing the javascript submit) send to the frame containing the
    website so the actual javascript submit is sent on that site,
    resaulting in it updating the dynamic page with the new input i called
    for

    If this makes sense to any of you please help me out, if it doesnt i
    will be happy to try and further explain it
    , Jan 19, 2006
    #1
    1. Advertising

  2. wrote:

    > Im currently trying to build a simple extension to a website allowing
    > me ot have a list of users in a frame beside the actual site.
    > Problem is the actual website uses javascript to update the contents
    > of dynamic pages so a link to a user on the website is:
    > javascript:SubmitMain("/traveller.asp","u~14756|flag~14756")


    It should not: <URL:http://jibbering.com/faq/#FAQ4_24>

    > [...]
    > What im trying to do is to make the links in the userlist frame
    > (containing the javascript submit) send to the frame containing
    > the website so the actual javascript submit is sent on that site,
    > resaulting in it updating the dynamic page with the new input i
    > called for


    SubmitMain() is /your/ method. In order to change its behavior,
    you have to change its code. Since that code is unknown to this
    group, only guesses are possible. Say the frame in which the
    "actual site" is displayed is named "site", that could be for
    example:

    <script type="text/javascript">
    function submitMain(baseURL, userData)
    {
    function isMethodType(s)
    {
    return (s == "function" || s == "object");
    }

    var esc = (isMethodType(typeof encodeURIComponent)
    ? encodeURIComponent
    : (isMethodType(typeof escape)
    ? escape
    : function(s) { return s; }));

    window.parent.frames['site'].location =
    window.location.match(/^https?:\/\/[^\/]+\//)[0]
    + baseURL.replace(/^\//, "") + "?" + esc(userData);
    }
    </script>
    ...
    <a href="no_script.html"
    onclick='submitMain("/traveller.asp", "u~14756|flag~14756"); return
    false;'
    >Joe User</a>


    However, the same functionality could be achieved without any script:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    ...
    <base href="/traveller.asp" target="site">
    ...
    </head>

    <body>
    <ul>
    <li><a href="?u~14756%7Cflag~14756">Joe User</a></li>
    ...
    </ul>
    </body>
    </html>

    Since you have ASP available, that list can be generated by ASP code.


    PointedEars

    P.S.: The pronoun "I" is written with a capital letter always.
    Thomas 'PointedEars' Lahn, Feb 16, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gan
    Replies:
    2
    Views:
    502
  2. Jim Mesara
    Replies:
    0
    Views:
    135
    Jim Mesara
    Aug 27, 2003
  3. Arvin Portlock
    Replies:
    4
    Views:
    283
    Arvin Portlock
    Jul 12, 2004
  4. Rob Gordon

    Breaking a frame from a different frame

    Rob Gordon, Oct 17, 2004, in forum: Javascript
    Replies:
    0
    Views:
    138
    Rob Gordon
    Oct 17, 2004
  5. Keith Lee
    Replies:
    4
    Views:
    162
    Tintin
    Feb 20, 2006
Loading...

Share This Page