/    Sign up×
Community /Pin to ProfileBookmark

Troubles loading from a form into a frame…

function search() {
var target=0;
{
target=parent.frames[2];
document.tool.action=’http://domain.com/cgi-bin/wcx.pl‘;
document.tool.method= ‘post’;
document.tool.submit(target);
return(true);
}
}

Everytime it loads in the frame the function is called from. I want it to load to a different frame. I’m no java expert here, just learning as I go. I figure this has to be an easy fix but I have checked all kinds of references and got nothing.

Please help, thanks in advance.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoApr 19.2006 — 
  • 1. Never use predefined variables such as target, or in some cases searhc, as names for variables of functions.


  • 2. the parent of the form is the frame that it is in.


  • 3. You only need one set of curly brackets.


  • 4. If you don't want your variable to be an integer then don't set it equal to 0.


  • You can do parent.parent to make it the parent of the frame. Or you can do the smarter thing and use top.

    function mySearch() {
    var tar=null;
    tar=top.frames[2];
    document.tool.action='http://domain.com/cgi-bin/wcx.pl';
    document.tool.method= 'post';
    document.tool.submit(tar);
    return(true);
    }
    Copy linkTweet thisAlerts:
    @ahab71authorApr 19.2006 — Thanks for the feedback.

    Unfortunately that isn't doing the job, it still loads in my top frame and not my lower frame.

    I have the window with two frames, upper and lower. I'm trying to get the function to load the information in the lower frame which is frame[2]. but it still loads in the upper frame which is frame[1].

    I'm wondering if my mistake is using a variable to designate the location...

    Thanks again,

    Any other information would be great.
    ×

    Success!

    Help @ahab71 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.14,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...