473,386 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

NN 4.0+ i/layer self-awareness

PAD
I have written a javascript routine that populates a parent document
with a series of <iframe>s. Each <iframe> receives its contents from a
series of separate smaller HTML files. Of course my NN 4.8 browser
doesn't deal well with the <iframe> so I wrapped the code that generates
the <iframe> in <ilayer> tags. NN now recognizes the contents.

However within each of the 'content' files I have another javascript
routine that basically displays the file name (via document.URL &
document.write) of the content file. My IE 5.5 & Mozilla 1.5
understands this perfectly. However my NN responds to the document.URL
with the wrapper/parent document's URL, not it's own unique file name.

I've named/ID'd the iframes & ilayers. If the document.URL fails I can
still make use of the ilayer ID but I need to know the index into the
layers array. I can hard-code a index value into the
document.layers[x].name but given that the position of the particular
content file is dynamic within the parent, the index is going to be
wrong 9 out of 10 times. There doesn't seem to any way for an i/layer
to know who it is...

I've looked through my books (O'Reilly Javascript 1.5 and a couple
D/HTML books), plus the 'Net (event the FAQ's from this NG) and have
found nothing about how the NN 4.0 failure (to my way of thinking ;-)
can be resolved. While I calculate about 1% of the site visitors will
use the old NN 4.0+ browsers... it has now become something of a crusade
of mine LOL
The content files have <head</head><body></body> tags but no
<html></html> tags. I've tried removing the <head> tags and/or
including the <html> tags but it seems to have no effect.

Here is the code that generates the layers/frames within the parent
document (other than this code in a JS file, there's nothing fancy
within the parent. ie it's isn't framed - just plain HTML). This
snippet of code is done 10 times for each parent page...

lno - is the uniqueness identifier for each content file. It's a
sequence number but there are gaps in the sequence. So 123rbe.html is
not going to follow 122rbe.html nor will 124 follow 123.

html = html + '<ilayer ID=\'fy'+ lno + '\' SRC=\'rbk/' + lno +
'rbe.html\'></ilayer><nolayer>';
html = html + '<iframe ID=\'fy'+ lno + '\' SRC=\'rbk/' + lno +
'rbe.html?inp=rbk\' BORDER=0 +
HEIGHT=\'250\' WIDTH=\'100%\' FRAMEBORDER=\'1\' MARGINWIDTH=0
MARGINHEIGHT=0></iframe>';
html = html + '</nolayer>';
html = html + '<br>';
Thanks for any help!
Pete

Jul 20 '05 #1
1 1917
since nobody else is answering this question, i guess i will...

PAD wrote:

I have written a javascript routine that populates a parent document
with a series of <iframe>s. Each <iframe> receives its contents from a
series of separate smaller HTML files. Of course my NN 4.8 browser
doesn't deal well with the <iframe> so I wrapped the code that generates
the <iframe> in <ilayer> tags. NN now recognizes the contents.
<layer> would be better -- there are rendering discrepencies/problems
with ilayer. <layer> will "behave" like an ilayer if you leave out the
top and left properties when setting it up.

However within each of the 'content' files I have another javascript
routine that basically displays the file name (via document.URL &
document.write) of the content file. My IE 5.5 & Mozilla 1.5
understands this perfectly. However my NN responds to the document.URL
with the wrapper/parent document's URL, not it's own unique file name.

I've named/ID'd the iframes & ilayers.
with <layer> only ID would be necessary. Layers are position absolute by
default (although they will be positioned "inline" so-to-speak if you do
not apply top and left properties. If you've nested layers and require
setting the top and left values for positioning, specify
style="position: relative;" for the layer to make it behave as an ilayer.

in general, avoid ilayer...
If the document.URL fails I can
still make use of the ilayer ID but I need to know the index into the
layers array.
no you don't...

for the url, use this.src (from within the loaded document).
for the id of the layer used to contain the loaded document, use this.id
[this.name is also available IF it was used in the tag] from within the
loaded document.

parent doc:

<layer id = holder src = "whatever.htm" attributes...>
</layer>
<!-- works with layer/ilayer -->

whatever.htm:

<html>
<head>
</head>
<body>
<script>
document.write(this.src); // prints: file:///HD/pathto/"whatever.htm"
</script>
</body>
</html>

an alternative would be:

<html>
<script>
onload = function()
{
// dynamically set the content
document.layers.holder.src = "whatever.htm";
}
</script>
<body>

<layer id = holder attributes...></layer>
</body>
</html>

you get the same results... with layer only, not ilayer.
....no hardcoding necessary.
I can hard-code a index value into the
document.layers[x].name but given that the position of the particular
content file is dynamic within the parent, the index is going to be
wrong 9 out of 10 times. There doesn't seem to any way for an i/layer
to know who it is...

I've looked through my books (O'Reilly Javascript 1.5 and a couple
D/HTML books), plus the 'Net (event the FAQ's from this NG) and have
found nothing about how the NN 4.0 failure (to my way of thinking ;-)
can be resolved. While I calculate about 1% of the site visitors will
use the old NN 4.0+ browsers... it has now become something of a crusade
of mine LOL
for..in is your best friend for sniffing out properties...

it's possible to provide an extensive amount of new DOM support to
NN4...if you're on that much of a crusade... like
document.getElementById and even innerHTML if you're really fanatical
(settable, not really readable without a very cumbersome workaround).
NN4 is fast enough to handle the extra code without noticeably slowing down.

However, take it from a chronic addicted NN4 user... it ain't really
worth it... All of us "hanger's on" like specific things about nn4,
like, the mail and news readers and, for most sites, it still works well
enough, plus, it's smaller than the newer generations... but truth be
told, I spend most of my time online with 2, maybe 3 (or more) browsers
open at the same time... if I run into a site that gives me problems in
NN4 -- it's *expected* (these days) -- and I just copy and paste the URL
into a newer browser for that specific site. I'm a professional site
designer and I gave up providing support for NN4 over 6 months ago
(which, for me, is a simple drop of a library into the document and
tweaking a couple of exceptions in the code).

for a demo of new DOM for ol' NN4, check out: http://fxmahoney.com/joshkelley

this site was originally developed without NN4 support, so you'll need
to visit it in NN4 and IE5+/NN6+ separately [I was originally told NN4
support was not necessary...but somebody's wires got crossed...] --
however, you'll see from the main code, very little alteration was made
to accommodate NN4 from the original new DOM code. [ps - i am not
responsible for the design of that page, only the programming]

click the link to Enter Site and View Source on the popped up
document... all of the new DOM support needed for that document (in the
NN4 version) was copied and pasted into that document with the exception
of the link rollover code which is in a separate .js doc [which can be
grabbed with one of the newer browsers by pasting the url into the
location]. There is enough there to give you a huge leg up on writing
your own support code. [do NOT write me and ask about how to proceed or
why I did what I did...you have to figure it out for yourself -- i did
my time with nn4... just pay attention to the watch method and the way
you read css attributes in NN4... and the fact that you can make up your
own css attributes and nn4 will happily accumulate them into the
stylesheet while all new browsers "sanitize" attributes they don't
understand. example:

#mydiv {
position: absolute;
use-class: myclass; /* access in NN4 to which class combined */
}

..myclass {
... more attributes
}
in NN4 you can relate .myclass attributes within a layer from the
"stuffed" attribute in the ID -- this is useful, along with the watch
method, in constructing a usable innerHTML method that can change the
content of a layer (you have to completely reconstruct all the styles
before document.writing to the layer -- and you will still not be able
to read the actual HTML of a layer -- you'll have to store a copy in a
variable or create a property of the layer in use:

myLayer.html = htmlStr;

but this is more trouble than it's worth and usually not necessary.)

]
[remember the rule about css <-> jss naming -- what is use-class in css
becomes useClass in jss...]

okay...

JSS style sheets are accessed in NN4 as:

IDs [ex: #myID { attributes } ]

document.ids.myID.attribute
or
document.ids["myID"].attribute

Classes [ex: .myClass {attributes} ]

document.classes.myClass.all.attributes or
document.classes["myClass"].all.attributes

where all should normally be used, but can be substituted with a TAG
name, like:

document.classes.myClass.DIV.attributes

// in NN4, you will run into all kinds of problems with links and tables...
// best to plan your CSS as "generally" as possible...
// meaning: use all, all the time if you plan to support nn4

Tags:

document.tags.TAGNAME.attribute [ex: document.tags.DIV.attribute]
TAGNAME, I believe, has to be all uppercase.

There's supposed to be a way to get at contextuals, but I was never able
to nail that one down...Martin Honnen might know this one.

BTW, all of these are settable as well as gettable (even the custom
attributes)... but setting them ONLY works BEFORE the page loads, and
before the items using the styles will be rendered [which means, at the
top of a <script> executed before the <body> tag opens -- the perfect
place to make "adjustments" and "repairs" to NN4 CSS]


The content files have <head</head><body></body> tags but no
<html></html> tags. I've tried removing the <head> tags and/or
including the <html> tags but it seems to have no effect.
they're expected in "well-formed" documents...leave them in.

Here is the code that generates the layers/frames within the parent
document (other than this code in a JS file, there's nothing fancy
within the parent. ie it's isn't framed - just plain HTML). This
snippet of code is done 10 times for each parent page...

lno - is the uniqueness identifier for each content file. It's a
sequence number but there are gaps in the sequence. So 123rbe.html is
not going to follow 122rbe.html nor will 124 follow 123.

html = html + '<ilayer ID=\'fy'+ lno + '\' SRC=\'rbk/' + lno +
'rbe.html\'></ilayer><nolayer>';
html = html + '<iframe ID=\'fy'+ lno + '\' SRC=\'rbk/' + lno +
'rbe.html?inp=rbk\' BORDER=0 +
HEIGHT=\'250\' WIDTH=\'100%\' FRAMEBORDER=\'1\' MARGINWIDTH=0
MARGINHEIGHT=0></iframe>';
html = html + '</nolayer>';
html = html + '<br>';
this looks more complicated than it needs to be...

here's a tip -- in HTML, you don't need quotes unless there are spaces
involved, so:

id = somename or id = "some name" or id = 'some name'
width = 100% or width = "100%" // or with singles
etc...

so then:

html += "<layer id = fy" + lno + " src = rbk" + lno +
"rbe.html width=100% height=250></layer>" ...


Thanks for any help!
Pete


Very good luck, Pete...if nothing else, this is a very good programming
exercise for you and you will learn a considerable amount about the
inner workings of DOM elements (past and present). I have it on very
good authority that the .watch() method is still available in NN6+ and
will continue to be supported for the foreseeable future... it is an
exceptionally powerful tool...(and not available in IE)

Also, none of what you are about to embark on is in any book and there
is only very sketchy documentation available [only that the JSS
stylesheets can be accessed with that outlined above], so you'll have to
ferret all this stuff out yourself [for..in everything -- find out
what's there and how it changes and what you can make changes to...]

that joshkelley page only uses a document.getElementById for top level
layers... here's a more general version that will work with embedded
layers (and only the most commonly used getter/setters [well, except for clip]):

// there are no guarantees with the following
// use as a starting point for more extensive support

// You might want to turn off line-wrapping in your reader and reopen
this post
// to get the following -- it was copied from my original source code
and not
// intended to be posted on this ng

if(document.layers)
{

document.getElementById = function(name)
{

var matchedLayer = null;

recurseLayers = function(w, match)
{
if(w.document.layers[match])
matchedLayer = w.document.layers[match];
else
{
for(var i = 0; i < w.document.layers.length; i++)
recurseLayers(w.document.layers[i], match);
}
}

recurseLayers(window, name);

if(matchedLayer) // make this like new DOM:
{
if(!matchedLayer.style)
{

matchedLayer.style = new Style(matchedLayer);
}

}

return matchedLayer;

}

function Style(ref)
{

this.parent = ref;
this.watch("top", function(i,o,n)
{
this.parent.top =
this.parent.offsetTop = n;
return n;
}
);

this.watch("left", function(i,o,n)
{
this.parent.left =
this.parent.offsetLeft = n;
return n;
}
);
this.watch("clip", function(i,o,n)
{

var set = n.match(/\d+/g);

var lyr = this.parent;
lyr.clip.top = set[0];
lyr.clip.right = set[1];
lyr.clip.bottom = set[2];
lyr.clip.left = set[3];
return n;
}
);

this.watch("visibility", function(i,o,n)
{

this.parent.visibility = n;

return n;
}
);
}

}

You might also want to adopt that document.getImageByName routine (from
/joshkelley) to make backwards support with NN4 more general with new
browsers -- it follows the new DOM convention...
okay... i'm done.
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: DS | last post by:
Is there a way to automatically close the data reader connection? I'm using the MS Data Access Application block to substantially {entirely} separate the data access layer (DAL) from the business...
2
by: headware | last post by:
I'm relatively new to ASP.NET and ADO.NET, but I have a basic design question regarding the use of web services and APS.NET applications. Right now we have an application that uses web services to...
8
by: Rashmi | last post by:
Hi! I am new to web services. AFAIK, the advantages of using web services are : interoperable, easy integration and reuse, text based protocols and data formats - SOAP,WSDL,XML. Also, I read...
2
by: dkode | last post by:
Hello, I am laying out the architecture for a very large website that will scale to a very large degree. I have a couple of questions before I attempt to go and implement a Broker/Persistence...
1
by: rbg | last post by:
Hi, I am trying to understand the layering concept with the ASP.NET 2.0 apps. I have a ASP.NET 2.0 Web app which has 3 layers Presentation layer which contains UI elements and Input...
16
by: MS newsgroup | last post by:
I don't have clear reasons why we need business logic layer and data logic layer instead of having only data logic layer. Are there any good reasons for that?
16
by: Dotnet | last post by:
I want to so the "right thing". But first, I have a confession to make. I've built a few ASP.NET sites now (Version 2.0), and they all work fine. However, I have (and here's the confession) used...
8
by: andre rodier | last post by:
Hello, As indicated in the title, I am looking for a PHP library able to create on the fly complex SQL requests, on 5 or 6 dimensions, without problems occurs on many-to-many relations, etc. ...
1
by: Tobias Grimm | last post by:
Hi! I'm trying to get a WebService running (self hosting, without IIS) that uses SSL and loads the SSL key/certificate from a file (without using httpcfg.exe). I have a running service and...
4
by: Spam Catcher | last post by:
Hi all, I'm building a multi-tier web application that is primarily driven by a web service back end. Are there any configuration settings I should know about to increase the performance of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.