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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a layer over 2 frames 2

Status
Not open for further replies.

onirike

Programmer
Aug 3, 2000
91
CA
Hi!

I got a huge problem and I wonder if there is a solution.
I have a page with 2 frames: a small left frame in which my menu is displayed and a large right frame (main frame).
I need on a click on an item in the left frame to open a layer in the right frame... I can easily do this but it would require me to copy paste my layer code in every possible page that can be opened in the right frame...

Is there a way I could create a layer that would be defined in my menu (left frame) but that would open OVER the right frame?

Every test I did, I was always stuck using the current frame as my display area for my layer... I really need to do this... Any ideas?

Thanks,
Chris ;-)
 
Unfortunately, what you're trying to do is just not possible. You will, inevitably, have to paste *something* into each page that can be loaded in the right frame. Now you can make this a bit easier on yourself by storing the script source code in an external file and linking to it through the src attribute of the <script> tag. This way, if you need to make a change to the code, you only make it in one place, not each individual file.

And if your cringing at the thought of adding this one line to all your html files, you could use a pretty simple Perl script along the lines of:

#!/usr/bin/perl
@filearray = glob(&quot;*.html&quot;);
foreach $file(@filearray) {
open(F, $file);
open(W, &quot;>$file.2&quot;);
while(<F>) {
if($_ =~ /<HEAD>/) {
print W &quot;$_\n<script language=\'javascript\' src=\'src.js\'></script>\n&quot;;
} else {
print W $_;
}
}
close(F);
close(W);
}

Or something like that. Been working with PHP too much, haven't touched Perl in ages. Anyways...

Hope this helps,

brendanc@icehouse.net
 
IE5.5 suppors z-indexing (2.5 dimensiality?) for IFRAMES so if you make it an IFRAME, the layer can look like its inside the IFRAME jared@aauser.com
 
I disagree. You can dynamically generate a new layer in a different frame. Try something like this:
Code:
new_div = &quot;item name&quot;;
div_string = &quot;<DIV ID=&quot; + new_div + &quot; STYLE='position:absolute'></DIV>&quot;;
frame2.document.body.insertAdjacentHTML(&quot;BeforeEnd&quot;,div_string);
eval(div_pointer + &quot;= frame2.document.all.&quot; + new_div);
I think in Netscape you can do this:
Code:
eval(div_pointer + &quot;= new Layer(..,frame2,..)&quot;); or something
or try frame2.document.write()

Anyway, I know it is possible. You've just got to research the exact syntax. Try devedge.netscape.com or msdn.microsoft.com for specifics.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
Thx for your help guys!

Will try this!
Chris ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top