Forum Moderators: open

Message Too Old, No Replies

Frames and forms problem

         

traffik daddy

12:01 pm on Aug 8, 2003 (gmt 0)

10+ Year Member



Hi,

Firstly, I have a couple of sites that I want to link together and started experimenting with frames and forms. Now, I have a form on one site which when logged into logs into another site. Then I got thinking...

Basically, on my information site there is the basic login form (username/password) in the bottom frame. I use a top frame to describe my site. Rather than using target="_blank" to get another page to open I wanted the stats (member site) page to open in my top frame so they look as one site rather than two. They are two totally different URLS and I want to know if it is possible at all?

I tried using target="_parent" inside my form but it keeps opening a new page rather than opening in my main frame. Can you use the target command inside of forms?

Does anybody have any ideas at all?

I hope it all makes sense :)

Thanks in advance
Terry

mcavill

12:31 pm on Aug 8, 2003 (gmt 0)

10+ Year Member



Have you tried a javascript approach:

<a href="#" onClick="JavaScript:parent.topframename.location.href ='newfile.html'">change</a>

traffik daddy

1:16 pm on Aug 8, 2003 (gmt 0)

10+ Year Member



Thanks for your reply

I have never used that Javascript code. Here is a basic breakdown of the HTML that I use:

<form method="post" action="http://www.mymembershipsite.com/login.php">
<input type="text" name="username" size="12" maxlength="12" class="textbox">
<input type="password" name="password" size="12" maxlength="12" class="textbox">
<input type="reset" name="Reset" value="Reset" class="button">
<input type="submit" name="Submit2" value="Submit" class="button">
</form>

Okay, This code is one the information site with the frames. I have placed it in the bottom frame. Basically, it is a fixed frame that has the login form to my other site to make it simpler to navigate rather than switching sites all the time. Once the details are entered I want to other site to open up in my top frame of the information site rather than a new window.

I tried breaking down the javascript code in many ways to fit into my form to open in my top frame but still no joy. If I had, for example, my two frames called mainframe.htm and bottomframe.htm then I used

<form method="post" action="http:www.whatever.com" onclick="javascript:parent.topframename.location.href="mainframe.htm">

This is basically the code I used to try to get it to work but I know only a little javascript so I'm a little miffed.

Please help...

Thank you
Terry

tedster

3:06 pm on Aug 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I assume that by using target="_parent" you are getting an entirely new page but it is NOT opening a new window, correct? This is the standard behavior, because the parent for either one of your two frames is the entire frameset.

I wanted the stats (member site) page to open in my top frame

If you just want to load a different page in the top frame, then you need to do two things.

1. In the frameset document, within the frames tag for the top frame, declare a name for the top frame. Let's use name="display"

2. Then make sure that the link in your form (bottom frame) includes this attribute: target="display"

That should do it, and no javascript required.

traffik daddy

4:09 pm on Aug 11, 2003 (gmt 0)

10+ Year Member



Thank you for that Tedster, it works a treat now. I don't have much experience at using frames.

However, I have run into another problem. When I click my 'back' button on my browser and click on my 'home' button on my web site the frame stays there. If I used target="_top" would this replace the two frames in my browser?

Thanks again
Terry

traffik daddy

4:12 pm on Aug 11, 2003 (gmt 0)

10+ Year Member



Sorry, I should have stated my original idea to my site. I use frames but on only one page. See my site [traffic-solutions.co.uk...] and in the DHTML menu go to services/Pop-Unders and you will see the frames load.

My login works fine and it opens in the top frame. I clicked 'back' in my browser and tried to load a page but the bottom frame stayed put.

Any ideas?

Cheers
Terry