Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exchange TWO frame contents on one click 5

Status
Not open for further replies.

zefir

Technical User
Sep 21, 2000
344
EU
Let´s assume a left frame with a list of items
and a right frame with the actual content.
Then click item 1 . The content is shown in the
right frame, but the left should be loaded with a
new item list, where item 1 is LOCKED (not clickable).
This should be programmed by basic HTML, no Java, no Styles.
With tables its easy - the whole page is exchanged.
Who can help? ----G.Hoffmann
 
So you just want to disable the button when it is showing it's content - I guess the only way to do this without javascript is to exchange the lists, but this is probably less than desirable in terms of download times - even if they are only text links - it's still unnecessary time, when it could be done so much easier.

If you are using input type buttons - then you can disable them very easily by setting it's disabled property to true.

I am not sure about a pure HTML solution. I suggest trying javascript. BB "Alright whatever man, I'll hook up the hair, but I aint touchin the ring...Cause I'm still a pla--yer"
 
You can have a JavaScript function
<a href=&quot;#&quot; onclick=&quot;myNavigation('file1.htm','file2.htm')&quot;>your link</a>
and then in the <head> you put the function
function myNavigation(f1,f2)
{
leftframename.location.href=f1;
mainframename.location.href=f2;
}
 
Isn´t it funny, that such a simple task cannot be done by HTML ?
In fact, it´s not only necessary, to lock the input device (button),
but also to change it´s appearance.
Probably it´s easier to use tables. My students come sometimes
with frames and criticize then: your button is not locked ! This
page can be loaded once again by accident.
I have printed the Java code and try it later.
Thanks to everybody. G.Hoffmann
Rydel: I can´t mark your message as &quot;helpful&quot; - it´s no input available
on your letter for this purpose, perhaps because you are visitor.
 
Rydel: the mentioned Java Script method is OK,
but the problem is still not solved perfectly.
Loading two frames by one click results in
the necessity to click Browser´s &quot;Back&quot; also
two times, though the user expects that this should
work by ONE &quot;Back&quot; . Any help ?
G.Hoffmann
 
You can make your own back button..if I understand this right...you need to go back two pages at once...right?...to do this just make a link link this...

Code:
<a href=&quot;javascript:history.go(-2)&quot;>go back</a>

forward would be:

Code:
<a href=&quot;javascript:history.go(+2)&quot;>go forward</a>

[code]

it seems you like to use buttons so:

first in the head you put this

[code]

<script language=&quot;javascript&quot;

function goDirection(dir) {

     if (dir == &quot;back&quot;    
          window.location=&quot;javascript:history.go(-2)&quot;

     } else {
          window.location=&quot;javascript:history.go(+2)&quot;
}

then this goes where you want the buttons:

Code:
<form method=&quot;POST&quot; action=&quot;null&quot; onSubmit=&quot;goDirection(back)&quot;>

<input type=&quot;submit&quot; value=&quot;go back&quot;>
</form>

<form method=&quot;POST&quot; action=&quot;null&quot; onSubmit=&quot;goDirection(forward)&quot;>

<input type=&quot;submit&quot; value=&quot;go forward&quot;>
</form>

hope that helps,
-Greg
 
oh yea...if you are only using netscape or IE explorer, make sure you test it in both, this problem may not happen in both browsers...if it doesn't let me know and I'll give you so code to only show your back buttons if they are needed...Greg
 
um..1 more thing..if you use the buttons to go forward and back, I messed the code up, it should be:

Code:
<script language=&quot;javascript&quot;>

function goDirection(dir) {

     if (dir == &quot;back&quot;    
          window.location=&quot;javascript:history.go(-2)&quot;

     } else {
          window.location=&quot;javascript:history.go(+2)&quot;
    }
}

</script>

-Greg
 
Greg: thank you very much. I will give the printed
posts to a student (one of the few items which I
don´t program myself), because I know nothing about Java.
A quick look shows, that you recommend to install
a software &quot;back-button&quot; which replaces the Browser´s
&quot;back-button&quot;. Correct ?
I am not sure whether the receivers would
accept the solution.
This simple question &quot;replace two frames by one click&quot;
has obviously no simple answer.
---G.Hoffmann
 
this behavior depends on the browser type and version. i noticed that even one free on-line email service has the same problem (netadress or they have two frames - ad frame on top and the email body frame, and users have to click &quot;back&quot; button twice to get back to the mail folder. not very user-friendly! ---
---
 

hi guys,
how about alittle javascript to add to the fun...try this

function updateframe()
{
parent.main.location.href=&quot;ReportStatus1.asp&quot;
parent.idx1.location.href=&quot;Blank_ndx.htm&quot;
}
Where main is the name of the frame, idx1 is the name of a frame and the file in quotes is the file that loads inthe frame...this runs off of a link to another page like below...

<A href=&quot;javascript:updateframe()&quot;>Status Report</a>

this load the two pages simultaneously into the two frames...you should be able to convert this to add the third frame easily...

Bastien
 
All,

i haven't seen the simplest non-javascript solution yet:

have both frames in one frameset. Make a different frameset document for each menu item, and have different menu documents (and content, of course) for each of them.

Say, you have a menu like:

Item 1
Item 2
Item 3

When you're showing the content of item 1, allso show the accompanying menu, where the item 1 button simply is disabled. Go the same way for the other two and have each button load the frameset document that contains the desired menu and content.

True, it takes a lot of work and quite a few documents, but then again, how much bytes does a simple frameset definition take up ?
It keeps surprising me how quick javascript is pulled out of the closet instead of standard HTML solutions.

Regards,
Ronald.
 
I agree Ronald but then.....

why spend all that time creating all those framesets the content of which needs to be downloaded each new click when a simple javascript function can solve it for you?

starfishh ;-)
 
Starfish,

i really can't see what javascript can do about having to download a new page needed to be displayed. Besides, once a page is in cache, it won't be downloaded again unless changed. Again, i question whether javascript does that any other way.
I admit it takes a lot of work creating a bunch of frameset documents; i never said it was a better alternative, just an alternative ... and anyway, i suspect chucking a couple of bytes down the line (a frameset document needn't be that big) might be faster than executing all that script all the time, but i very well could be wrong.

Regards,
Ronald.
 
Thanks again for all contributions. I come back later.
Can we expect, that &quot;everybody&quot; can read and
execute these short Javascripts ?
----G.Hoffmann
 
The final solution:
Replace content in frame0 and frame2:

<Script Language=&quot;Javascript&quot;>
{
function TwoFrames(file0,file2)
parent.frames[0].location.replace(file0);
parent.frames[2].location.replace(file2);
}
</Script>
...
<Body....Onload =&quot;TwoFrames(´number0.html´,´number2.html´)&quot;>
</Body>

&quot;Replace&quot; prevents the browser from chaining all files.
This works for Java 1.1, NC 3.0, IE 4.0
The example is plain text, not actually tested.
---G.Hoffmann
 
An additional question to the JAVA experts:
Is it possible to use an alternative code part,
if an error occurs, like this ?
If Error In
Begin
parent.frames[0].location.replace(file0);
....
End;
Use
Begin
parent.frames[0].location.href=file0;
...
End;
The first block works for IE 4.0, the second for
older versions, but then several &quot;backs&quot; are necessary
to replace the whole screen content.
----G.Hoffmann
 
&quot;Not actually tested&quot; meant: the code works fine,
but the letter may have had type errors (but it´s OK) .
---G.Hoffmann
 
so, you want to find out which browser they have and the use the right code?...

Code:
if (navigator.appName.indexOf(&quot;Microsoft&quot;) != -1 && navigator.appVersion > 4.0 || navigator.appName.indexOf(&quot;Netscape&quot;) != -1 && navigator.appVersion > 3.0 ) {

//function for IE 4 and above goes here

} elseif (navigator.appName.indexOf(&quot;Microsoft&quot;) != -1 && navigator.appVersion < 4.0 || navigator.appName.indexOf(&quot;Netscape&quot;) != -1 && navigator.appVersion < 3.0 ) {

//function for IE 3 and less goes here

} else {
     alert(&quot;please switch to an Internet Explorer or Netscape browser&quot;)

} -Greg :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top