PC Review


Reply
Thread Tools Rate Thread

How to access property of a LAYER within Jscript?

 
 
José Joye
Guest
Posts: n/a
 
      8th Jun 2004
Hello,
I'm trying to update the size of a layer within my page as soon as the
window is resized. I look at the Jscript ref guide. However, I keep
receiving error when executing the script fired at window resize
(f_resize_bottom()). It tells me that document.layers["layer_bottom"] is
null or not an object.

Any help welcome :-)
José

Here is a code snippet:

<html>
<head>
<script>
<!--
function f_resize_bottom()
{
document.layers["layer_bottom"].width=
document.layers["layer_bottom"].window.innerWidth
}
//-->
</script >
</head>

<body onresize=f_resize_bottom()>

<div style="position: absolute; width:100%; height: 43px; z-index: 1000;
left: 2px; top: 200px" id="layer_bottom" name="layer_bottom">
<table border="0" cellpadding="0" cellspacing="0" style="margin-top:
8px" background="../images/fond_bandeau_bleu.gif">
<tr height="35px">
<td width="150" nowrap>
<p class="CRight">© 2004 All rights reserved<br>
My Company</td>
<td width="620"><img border="0" src="../images/bandeau_bleu.gif"
height="35" width="620"></td>
<td width="100%"></td>
</tr>
</table>
</div>
</body>


 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      8th Jun 2004


José Joye wrote:


> I'm trying to update the size of a layer within my page as soon as the
> window is resized. I look at the Jscript ref guide. However, I keep
> receiving error when executing the script fired at window resize
> (f_resize_bottom()). It tells me that document.layers["layer_bottom"] is
> null or not an object.


document.layers is part of the Netscape 4 object model, that object
doesn't exist in recent Netscape versions (6/7) and neither in any IE
version.
If you want to change the CSS inline settings of an element with a
certain id with IE5+, Netscape 6/7, Opera 7 and other browsers
implementing the W3C DOM try
var element;
if (document.getElementById) {
element = document.getElementById('elementId');
if (element && element.style) {
element.style.width = 440 + 'px';
}
}

As for the body onresize to change the width that shouldn't be necessary
at all if you use static CSS to set
width: 100%;
--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Reply With Quote
 
José Joye
Guest
Posts: n/a
 
      8th Jun 2004
Thanks for your answer.

This sounds like I'm not using the good reference guide for JavaScript (I'm
using the version 1.3 of Client Script from Netscape).
What will be the correct reference guide to use for writting against new
browser?

As a side note, I was not really trying to update the with of my Layer (this
was just a sample). What I'm hopping to do is to place within a layer a kind
of footer that will stay visible at the end of the window and stay there if
we resize the window or use the scroll bars.

Thanks,
José
"Martin Honnen" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
>
> José Joye wrote:
>
>
> > I'm trying to update the size of a layer within my page as soon as the
> > window is resized. I look at the Jscript ref guide. However, I keep
> > receiving error when executing the script fired at window resize
> > (f_resize_bottom()). It tells me that document.layers["layer_bottom"] is
> > null or not an object.

>
> document.layers is part of the Netscape 4 object model, that object
> doesn't exist in recent Netscape versions (6/7) and neither in any IE
> version.
> If you want to change the CSS inline settings of an element with a
> certain id with IE5+, Netscape 6/7, Opera 7 and other browsers
> implementing the W3C DOM try
> var element;
> if (document.getElementById) {
> element = document.getElementById('elementId');
> if (element && element.style) {
> element.style.width = 440 + 'px';
> }
> }
>
> As for the body onresize to change the width that shouldn't be necessary
> at all if you use static CSS to set
> width: 100%;
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/
>



 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      8th Jun 2004


José Joye wrote:


> This sounds like I'm not using the good reference guide for JavaScript (I'm
> using the version 1.3 of Client Script from Netscape).
> What will be the correct reference guide to use for writting against new
> browser?


Start with reading the http://jibbering.com/faq/, in particular
http://jibbering.com/faq/#FAQ2_8
and
http://devedge.netscape.com/viewsour...tml-web-pages/

> As a side note, I was not really trying to update the with of my Layer (this
> was just a sample). What I'm hopping to do is to place within a layer a kind
> of footer that will stay visible at the end of the window and stay there if
> we resize the window or use the scroll bars.


With CSS 2 you can use
position: fixed;
bottom: 100%;
to achieve that without scripting. Mozilla, Netscape 7, Opera 7 should
all support that, only IE on Win doesn't do that.

--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Reply With Quote
 
José Joye
Guest
Posts: n/a
 
      9th Jun 2004
Thanks for the links. Very nice :-)

I'm still having problem to position my DIV element at the bottom of the
window. I spent some time gooooogling and reading doc. However, was not
really successfull. Since the subject is a bit different, I started a new
thread
Positioning a DIV at the bottom of the window (compatible IE and
Opera) - how?


José
"Martin Honnen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
>
> José Joye wrote:
>
>
> > This sounds like I'm not using the good reference guide for JavaScript

(I'm
> > using the version 1.3 of Client Script from Netscape).
> > What will be the correct reference guide to use for writting against new
> > browser?

>
> Start with reading the http://jibbering.com/faq/, in particular
> http://jibbering.com/faq/#FAQ2_8
> and
> http://devedge.netscape.com/viewsour...tml-web-pages/
>
> > As a side note, I was not really trying to update the with of my Layer

(this
> > was just a sample). What I'm hopping to do is to place within a layer a

kind
> > of footer that will stay visible at the end of the window and stay there

if
> > we resize the window or use the scroll bars.

>
> With CSS 2 you can use
> position: fixed;
> bottom: 100%;
> to achieve that without scripting. Mozilla, Netscape 7, Opera 7 should
> all support that, only IE on Win doesn't do that.
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
business layer, data access layer , presentation layer for asp.net using C#.net Dhananjay Microsoft VB .NET 6 20th Dec 2006 02:16 AM
business layer, data access layer , presentation layer for asp.net using C#.net Dhananjay Microsoft C# .NET 2 19th Dec 2006 09:23 AM
business layer, data access layer , presentation layer for asp.net using C#.net Dhananjay Microsoft ASP .NET 1 18th Dec 2006 11:35 PM
How to distingusih Business Layer and Data Access Layer requirements pratham Microsoft C# .NET 4 31st Aug 2006 07:18 AM
Data Access Layer and Business Entity Layer =?Utf-8?B?UnlhbiBTaGF3?= Microsoft ADO .NET 0 24th Feb 2004 02:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:44 PM.