473,407 Members | 2,314 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,407 software developers and data experts.

Set a DIV to be a footer: lowest coordinates in a page

Hi ,

I have a DIV element in a page with a lot of other stuff (the page can
scroll several times) absolutely positioned:

<div id="MyDIV" <br<brFooter </div>

Just after the page load, I would like to find the lowest element in
the page and
set the "TOP" property of the DIV some 50 pixels below of such lowest
element .

Can anyone help me with this task.

-PAm

Aug 20 '06 #1
26 2267
I would try something like:
function positionFooter() {
var lastElem = document.getElementById("lastElem");
var footer = document.getElementById("footerDIV");
//Now the fun stuff
var offsetX = 0;
var offsetY = 0;
var elem = lastElem;
while (elem.offsetParent) {
offsetX += lastElem.offsetLeft;
offsetY += lastElem.offsetTop;
elem = elem.offsetParent;
}
//position stuff
footer.style.position = "absolute";
footer.style.left = offsetX;
footer.style.top = offsetY + lastElem.offsetHeight;
}

pa***********@libero.it wrote:
Hi ,

I have a DIV element in a page with a lot of other stuff (the page can
scroll several times) absolutely positioned:

<div id="MyDIV" <br<brFooter </div>

Just after the page load, I would like to find the lowest element in
the page and
set the "TOP" property of the DIV some 50 pixels below of such lowest
element .

Can anyone help me with this task.

-PAm
Aug 20 '06 #2
Thank you Benjamin!!

I have some problem to get it to work.
I tell you what I have done:

put

<script language="javascript">

function positionFooter() {
var lastElem = document.getElementById("lastElem");
var footer = document.getElementById("footerDIV");
//Now the fun stuff
var offsetX = 0;
var offsetY = 0;
var elem = lastElem;
while (elem.offsetParent) {
offsetX += lastElem.offsetLeft;
offsetY += lastElem.offsetTop;
elem = elem.offsetParent;
}
//position stuff
footer.style.position = "absolute";
footer.style.left = offsetX;
footer.style.top = offsetY + lastElem.offsetHeight;

</script>

in the header (right or should be in the body?)

Then, I placed a div in the bottom:

<DIV ID="footerDIV">Hello From Footer </DIV>

To try the script, I tried creating another div:

<div ID="lastElem" style="top:5000px"></div>

Nothing happened. Anyway, apart that, the basic problem is I do not
know what is the last
element and it does not have an ID. This is a document generated
automatically.
I meant to find the lowest element programmatically.

Sorry to bother, I am trying to learn some javascript. But I find it
very hard. I would need some kind of debugger with intellisense to
understand what is going on.

-Pam

Benjamin ha scritto:
I would try something like:
function positionFooter() {
var lastElem = document.getElementById("lastElem");
var footer = document.getElementById("footerDIV");
//Now the fun stuff
var offsetX = 0;
var offsetY = 0;
var elem = lastElem;
while (elem.offsetParent) {
offsetX += lastElem.offsetLeft;
offsetY += lastElem.offsetTop;
elem = elem.offsetParent;
}
//position stuff
footer.style.position = "absolute";
footer.style.left = offsetX;
footer.style.top = offsetY + lastElem.offsetHeight;
}

pa***********@libero.it wrote:
Hi ,

I have a DIV element in a page with a lot of other stuff (the page can
scroll several times) absolutely positioned:

<div id="MyDIV" <br<brFooter </div>

Just after the page load, I would like to find the lowest element in
the page and
set the "TOP" property of the DIV some 50 pixels below of such lowest
element .

Can anyone help me with this task.

-PAm
Aug 20 '06 #3
pa***********@libero.it wrote:
Thank you Benjamin!!
Please don't top-post here, reply below a trimmed quote of whatever you
are replying to.

I have some problem to get it to work.
I tell you what I have done:

put

<script language="javascript">

function positionFooter() {
var lastElem = document.getElementById("lastElem");
var footer = document.getElementById("footerDIV");
//Now the fun stuff
var offsetX = 0;
var offsetY = 0;
var elem = lastElem;
while (elem.offsetParent) {
offsetX += lastElem.offsetLeft;
offsetY += lastElem.offsetTop;
elem = elem.offsetParent;
}
//position stuff
footer.style.position = "absolute";
footer.style.left = offsetX;
footer.style.top = offsetY + lastElem.offsetHeight;
You are missing a closing brace.

</script>

in the header (right or should be in the body?)

Then, I placed a div in the bottom:

<DIV ID="footerDIV">Hello From Footer </DIV>

To try the script, I tried creating another div:

<div ID="lastElem" style="top:5000px"></div>

Nothing happened.
When did you call positionFooter()? It's not in you posted code.
Anyway, apart that, the basic problem is I do not
know what is the last
element and it does not have an ID. This is a document generated
automatically.
I meant to find the lowest element programmatically.
Client-side scripting is unreliable, any browser with JavaScript
disabled will not position your footer at all. You will be much better
off to seek a server-side solution.

Sorry to bother, I am trying to learn some javascript. But I find it
very hard. I would need some kind of debugger with intellisense to
understand what is going on.
Intellisense? I can't see how that would help. Maybe a search of the
archives would be better. I managed to find this link in about 30
seconds, it may be suitable or not...

<URL:
http://groups.google.com/group/micro...414b5e5a416ebf
>
There are reasonably frequent resquests to 'find the height of a page'
or similar, do a search.

[...]

--
Fred

Aug 20 '06 #4
Hi Benjamin,

Thanks Again.

Yes, late night, I was missing the most obvious: to call it.
Anyway I need this simple change:

I do not know javascript syntax, use a kind of invented pseudocode:

if Page.PageElements is empty orelse _
Page.PageElements containsOnly(MyFooterDiv) then
exit sub 'leave as is
end if

dim LowestElement as PageElement
dim LowestPos as integer = 0

for each PageElement in Page.PageElements

if PageElement.Y LowestPos then
LowestPos = PageElement.Y
PageElement = PageElement
end if

next PageElement

MyFooterDiv.Y = LowestElement.Y

what would the JS be?

Pam

Benjamin ha scritto:
I would try something like:
function positionFooter() {
var lastElem = document.getElementById("lastElem");
var footer = document.getElementById("footerDIV");
//Now the fun stuff
var offsetX = 0;
var offsetY = 0;
var elem = lastElem;
while (elem.offsetParent) {
offsetX += lastElem.offsetLeft;
offsetY += lastElem.offsetTop;
elem = elem.offsetParent;
}
//position stuff
footer.style.position = "absolute";
footer.style.left = offsetX;
footer.style.top = offsetY + lastElem.offsetHeight;
}

pa***********@libero.it wrote:
Hi ,

I have a DIV element in a page with a lot of other stuff (the page can
scroll several times) absolutely positioned:

<div id="MyDIV" <br<brFooter </div>

Just after the page load, I would like to find the lowest element in
the page and
set the "TOP" property of the DIV some 50 pixels below of such lowest
element .
Aug 21 '06 #5
Client-side scripting is unreliable, any browser with JavaScript
disabled will not position your footer at all. You will be much better
off to seek a server-side solution.
Do not agree entirely. Server side solution are built on top
of script technology, so it is easier that a simple script will work.
If you restrict yourself to Microsoft technology, that can be true,
but you might lose some half planet.

The fundamental mechanism (postback) of ASP pages
is based on a javascript script.

For instance: http://www.xefteri.com/articles/show.cfm?id=18

Pam

Aug 21 '06 #6
Hi,

pa***********@libero.it wrote:
>>Client-side scripting is unreliable, any browser with JavaScript
disabled will not position your footer at all. You will be much better
off to seek a server-side solution.


Do not agree entirely. Server side solution are built on top
of script technology, so it is easier that a simple script will work.
That's not correct. Server-side technology works (if implemented
consistently) even if client-side script is disabled.
If you restrict yourself to Microsoft technology, that can be true,
but you might lose some half planet.
If you mean client-side, that's more like 15%, with a few local
exception (Germany). If you mean server-side, the technology the server
runs on doesn't/shouldn't affect the user.
The fundamental mechanism (postback) of ASP pages
is based on a javascript script.
But if client-side script is not enabled, you can still post pages back.
The user just loses some comfort (i.e. has to press a submit button
instead of having autopostback for elements like SELECT, etc.
For instance: http://www.xefteri.com/articles/show.cfm?id=18
Developers should never rely on cient-side script for functionality.
Client-side script should only be used for the user's convenience. For
example, to avoid roundtrips for validation, or in that case, to allow
easier, more automatic postbacks. That doesn't mean that you should
avoid implementing a foolproof solution anyway.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 21 '06 #7
Sorry, forgot to add that

pa***********@libero.it wrote:
The fundamental mechanism (postback) of ASP pages
is based on a javascript script.
You mean ASP.NET. ASP is a very different kind of animal.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 21 '06 #8

pa***********@libero.it wrote:
Client-side scripting is unreliable, any browser with JavaScript
disabled will not position your footer at all. You will be much better
off to seek a server-side solution.

Do not agree entirely. Server side solution are built on top
of script technology, so it is easier that a simple script will work.
The issue isn't the script (or program or whatever), but where it's
implemented. Presumably you have full control over the server so you
can pretty much guarantee that your script will run as required
(assuming appropriate testing, etc.). You have zero control over the
client and can't even reliably test whether scripting is supported at
all, much less the extent to which required functionality is supported.

All you can do is hope your script runs, test features as you go and
provide fallback for whatever isn't supported - at least to the extent
that the page is still functional if not quite so pretty. If you do the
work on the server and send your 'footer' appropriately positioned in
the source HTML, you can be much more confident that will happen.

If you restrict yourself to Microsoft technology, that can be true,
but you might lose some half planet.
At no time have I mentioned any particular technology other than
JavaScript (this is a JavaScript group after all). If you have an
issue with Microsoft technologies, take that up in a Microsoft forum -
I don't think it's relevant here.

The fundamental mechanism (postback) of ASP pages
is based on a javascript script.

For instance: http://www.xefteri.com/articles/show.cfm?id=18
That example shows using an A element to submit a form using script and
javascript pseudo-protocol in the href attribute - a nonsensical idea,
particularly in IE. It just goes to show how awful Microsoft's
documentation can be.

I don't think it has any relevance to the problem you've posted.
--
Fred

Aug 21 '06 #9
That's not correct. Server-side technology works (if implemented
consistently) even if client-side script is disabled.
That may be true. In the specific I will use this script within an
ASP.NET
solution. The postback technology has simplified a lot server side
programming. ASP id dead. I could do everything with Get/Post... but
why make life harder?
If you mean client-side, that's more like 15%, with a few local
exception (Germany). If you mean server-side, the technology the server
runs on doesn't/shouldn't affect the user.
Don't know the statistic, but we in Italy I see only Microsoft.
The fundamental mechanism (postback) of ASP pages
is based on a javascript script.

Developers should never rely on cient-side script for functionality.
Client-side script should only be used for the user's convenience. For
example, to avoid roundtrips for validation, or in that case, to allow
easier, more automatic postbacks. That doesn't mean that you should
avoid implementing a foolproof solution anyway.
A programmer cannot take burden of everying else can happen in the
world. One gives
the specifications. The user/enterprise is free to use or not the
program.
People with scripts disabled do not go much far anyway.

-Pam

Aug 21 '06 #10
All you can do is hope your script runs, test features as you go and
provide fallback for whatever isn't supported - at least to the extent
that the page is still functional if not quite so pretty. If you do the
work on the server and send your 'footer' appropriately positioned in
the source HTML, you can be much more confident that will happen.
I do not have to hope. That is a part of the program specification.
If the user want to use it, that is required. Otherwise she is free not
to use
it.
At no time have I mentioned any particular technology other than
JavaScript (this is a JavaScript group after all). If you have an
issue with Microsoft technologies, take that up in a Microsoft forum -
I don't think it's relevant here.
Microsoft technology is the only one I used so far. No issue with that.
My meaning was different.
The fundamental mechanism (postback) of ASP pages
is based on a javascript script.

For instance: http://www.xefteri.com/articles/show.cfm?id=18

That example shows using an A element to submit a form using script and
javascript pseudo-protocol in the href attribute - a nonsensical idea,
particularly in IE. It just goes to show how awful Microsoft's
documentation can be.
That is a basic explanation of the inner working of ASP.NET. That
nonsensical idea is making billions :)

-Pam

Aug 21 '06 #11
Let's go back to technology.

Anyone is able to provide the JS translation of the following
(invented and just revised) pseudocode ?

\\

if Page.PageElements is empty orelse _
Page.PageElements containsOnly(MyFooterDiv) then
exit sub 'leave as is
end if

dim LowestElement as PageElement
dim LowestPos as integer = 0
dim SomeShift as integer = 50

for each PageElement in Page.PageElements

if PageElement IsNot MyFooterDiv then

if PageElement.Y LowestPos then
LowestPos = PageElement.Y
LowestElement = PageElement
end if

end if

next PageElement

MyFooterDiv.Y = LowestElement.Y + SomeShift

//

-Pam

Aug 21 '06 #12
pa***********@libero.it wrote:
Let's go back to technology.

Anyone is able to provide the JS translation of the following
(invented and just revised) pseudocode ?
Your 'find the lowest element' logic is flawed - you want the lowest
bottom, not the lowest top.

I think you're really after the height of the body element, so get it
and set your 'footer' below that. How will you handle the user changing
the size of the text which will probably make the page overlap your footer?

<URL: http://www.quirksmode.org/viewport/compatibility.html >
--
Fred
Aug 21 '06 #13
Hi,

pa***********@libero.it wrote:
>>That's not correct. Server-side technology works (if implemented
consistently) even if client-side script is disabled.


That may be true. In the specific I will use this script within an
ASP.NET
solution. The postback technology has simplified a lot server side
programming. ASP id dead. I could do everything with Get/Post... but
why make life harder?
That is correct. My comment was aimed at the "built on top of script
technology" comment. That could be misleading for newbies. ASP.NET uses
JavaScript to improve the user's experience, but also works without
script (I am speakng generally here).
>>If you mean client-side, that's more like 15%, with a few local
exception (Germany). If you mean server-side, the technology the server
runs on doesn't/shouldn't affect the user.


Don't know the statistic, but we in Italy I see only Microsoft.
So that would be 100%. My point is: If you restrict yourself with
Microsoft tech (meaning: if you use only MS technology), then you're not
losing half the planet.

Also, ASP.NET allows browser independancy in a much, much better way
than any time before. So really, it's easy not to program for one single
browser.
>>Developers should never rely on cient-side script for functionality.
Client-side script should only be used for the user's convenience. For
example, to avoid roundtrips for validation, or in that case, to allow
easier, more automatic postbacks. That doesn't mean that you should
avoid implementing a foolproof solution anyway.


A programmer cannot take burden of everying else can happen in the
world. One gives
the specifications. The user/enterprise is free to use or not the
program.
People with scripts disabled do not go much far anyway.

-Pam
I'd love to live in your world, the one where you can afford to lose
customers ;-)

That said, there are issues that you are not allowed to ignore. For
example form validation should never rely only on client-side scripts.

Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 21 '06 #14
Your 'find the lowest element' logic is flawed - you want the lowest
bottom, not the lowest top.

Hi Fred, Thanks for the input

I think everyone undestood here, although my English is probably a
disaster. I am looking for the one which is most down, say towards the
floor, not the sky! :)

Which part of the pseudocode is flawed ? I use to measure Y screen
coordinates going from top towards down. That's the standard. Don't
know if you are referring to that or something else...
I think you're really after the height of the body element, so get it
and set your 'footer' below that. How will you handle the user changing
the size of the text which will probably make the page overlap your footer?
I do not know how to precisely translate that in Javascript. That why I
am asking you experts! :)

I have a pile of DIVs in a long column. They are all * absolutely
positioned * and do not have an ID. I want to add another DIV at the
end of the column (bottom).
The script must position this last DIV. That's all. :)
-Pam
>
<URL: http://www.quirksmode.org/viewport/compatibility.html >
--
Fred
Aug 21 '06 #15
I'm sorry I'm not exactly sure what you want. What does "dim" or "sub"
mean? Could you put it in more of a paragraph form? Thanks!
pa***********@libero.it wrote:
Let's go back to technology.

Anyone is able to provide the JS translation of the following
(invented and just revised) pseudocode ?

\\

if Page.PageElements is empty orelse _
Page.PageElements containsOnly(MyFooterDiv) then
exit sub 'leave as is
end if

dim LowestElement as PageElement
dim LowestPos as integer = 0
dim SomeShift as integer = 50

for each PageElement in Page.PageElements

if PageElement IsNot MyFooterDiv then

if PageElement.Y LowestPos then
LowestPos = PageElement.Y
LowestElement = PageElement
end if

end if

next PageElement

MyFooterDiv.Y = LowestElement.Y + SomeShift

//

-Pam
Aug 21 '06 #16

Benjamin wrote:
I'm sorry I'm not exactly sure what you want. What does "dim" or "sub"
mean? Could you put it in more of a paragraph form? Thanks!
If you could not tell, he's using vbscript. Where "dim" is equivalent
to "var" and "sub" is similar to "function".

Aug 21 '06 #17
If you could not tell, he's using vbscript. Where "dim" is equivalent
to "var" and "sub" is similar to "function".
correct

Benjamin,

I will say in word:
if Page.PageElements is empty orelse _
Page.PageElements containsOnly(MyFooterDiv) then
exit sub 'leave as is
end if
If page contains nothing or only the footer DIV
there is nothing to do. Exit the void function.
dim LowestElement as PageElement
dim LowestPos as integer = 0
dim SomeShift as integer = 50
define 3 variables. The first variable is for iteration
in the collection of page elements. The second
to store the bottom position. And the third
to store the element which featured such
position.
for each PageElement in Page.PageElements
if PageElement IsNot MyFooterDiv then
if PageElement.Y LowestPos then
LowestPos = PageElement.Y
LowestElement = PageElement
end if
end if
next PageElement
Iterate on all the elements different fron the footer DIV
to find out which is has lowest position
MyFooterDiv.Y = LowestElement.Y + SomeShift
Once you find it assign the footer position as the position
of the lowest element plus some vertical offset

//

Thanks

-P

Aug 21 '06 #18

pa***********@libero.it wrote:
Fred said:
I think you're really after the height of the body element, so get it
and set your 'footer' below that. How will you handle the user changing
the size of the text which will probably make the page overlap your footer?

I do not know how to precisely translate that in Javascript. That why I
am asking you experts! :)
That's why I've posted links for you to use to write some code.

I have a pile of DIVs in a long column. They are all * absolutely
positioned * and do not have an ID. I want to add another DIV at the
end of the column (bottom).
The script must position this last DIV. That's all. :)
Follow the link I povided in my previous post. quirksmode has lots of
information about JavaScript with working examples, it's one of the
best sites you can use to learn about JavaScript.
--
Fred

Aug 21 '06 #19
function afunc() {
var search = document.body.getElementsByTagName("*");
if (search.length <= 1) {
return;
}
var i = 0;
var bottomPos = 0;
var bottomElem = 0;
var offsetY = 0;
offsetObj;
for (i = 0; i < search.length; i++) {
if (search[i].id = "myFooter") {
continue;
}
offsetObj = search[i];
while (offsetObj) {
offsetY += (offsetObj.offsetTop +
offsetObj.offsetHeight);
offsetObj = offsetObj.offsetParent
}
bottomPos = (offsetX bottomPos) ? offsetX : bottomPos;
}
var myFooter = document.getElementById("myFooter");
myFooter.style.position = "absolute";
var your Padding = 50;
myFooter.style.top = bottomPos + yourPadding + "px";
}
trigger this function like this: <body onload="afunc()">
pa***********@libero.it wrote:
If you could not tell, he's using vbscript. Where "dim" is equivalent
to "var" and "sub" is similar to "function".

correct

Benjamin,

I will say in word:
if Page.PageElements is empty orelse _
Page.PageElements containsOnly(MyFooterDiv) then
exit sub 'leave as is
end if

If page contains nothing or only the footer DIV
there is nothing to do. Exit the void function.
dim LowestElement as PageElement
dim LowestPos as integer = 0
dim SomeShift as integer = 50

define 3 variables. The first variable is for iteration
in the collection of page elements. The second
to store the bottom position. And the third
to store the element which featured such
position.
for each PageElement in Page.PageElements
if PageElement IsNot MyFooterDiv then
if PageElement.Y LowestPos then
LowestPos = PageElement.Y
LowestElement = PageElement
end if
end if
next PageElement

Iterate on all the elements different fron the footer DIV
to find out which is has lowest position
MyFooterDiv.Y = LowestElement.Y + SomeShift

Once you find it assign the footer position as the position
of the lowest element plus some vertical offset

//

Thanks

-P
Aug 24 '06 #20
Thank you Benjamin!! You are a star!

Beautiful code.

-Pam

PS
I am studying javascript. I like it, but I am used to tools like
debuggers and intellisense (I work with VS2005/ASP.NET). Is there
something similar for javascript? My greatest problem is to remember
all the objects members names and to type correctly the statements.
Also, the issues about cross compatibility make things more
complicated.

I noticed many people use underscore "_" to start variable names. Is
that a style or some kind of compatibility trick?

Benjamin ha scritto:
function afunc() {
var search = document.body.getElementsByTagName("*");
if (search.length <= 1) {
return;
}
var i = 0;
var bottomPos = 0;
var bottomElem = 0;
var offsetY = 0;
offsetObj;
for (i = 0; i < search.length; i++) {
if (search[i].id = "myFooter") {
continue;
}
offsetObj = search[i];
while (offsetObj) {
offsetY += (offsetObj.offsetTop +
offsetObj.offsetHeight);
offsetObj = offsetObj.offsetParent
}
bottomPos = (offsetX bottomPos) ? offsetX : bottomPos;
}
var myFooter = document.getElementById("myFooter");
myFooter.style.position = "absolute";
var your Padding = 50;
myFooter.style.top = bottomPos + yourPadding + "px";
}
trigger this function like this: <body onload="afunc()">
pa***********@libero.it wrote:
If you could not tell, he's using vbscript. Where "dim" is equivalent
to "var" and "sub" is similar to "function".
correct

Benjamin,

I will say in word:
if Page.PageElements is empty orelse _
Page.PageElements containsOnly(MyFooterDiv) then
exit sub 'leave as is
end if
If page contains nothing or only the footer DIV
there is nothing to do. Exit the void function.
dim LowestElement as PageElement
dim LowestPos as integer = 0
dim SomeShift as integer = 50
define 3 variables. The first variable is for iteration
in the collection of page elements. The second
to store the bottom position. And the third
to store the element which featured such
position.
for each PageElement in Page.PageElements
if PageElement IsNot MyFooterDiv then
if PageElement.Y LowestPos then
LowestPos = PageElement.Y
LowestElement = PageElement
end if
end if
next PageElement
Iterate on all the elements different fron the footer DIV
to find out which is has lowest position
MyFooterDiv.Y = LowestElement.Y + SomeShift
Once you find it assign the footer position as the position
of the lowest element plus some vertical offset

//

Thanks

-P
Aug 24 '06 #21
Hi,

pa***********@libero.it wrote:

<snip>
PS
I am studying javascript. I like it, but I am used to tools like
debuggers and intellisense (I work with VS2005/ASP.NET). Is there
something similar for javascript? My greatest problem is to remember
all the objects members names and to type correctly the statements.
Also, the issues about cross compatibility make things more
complicated.
There is some JavaScript Intellisense in Visual Studio 2005, but it's
limited. Since JavaScript is a very flexible language, where you can add
properties to an object on runtime, it's difficult to implement
Intellisense for that language.

I still recommend VS2005 for JavaScript development, if only because you
can debug the client and the server in the same application, using the
client-side script debugger and the CLR debugger on the server. It's
really handy to start both sides of an application using F5 and to jump
form one to the other (for example for webservices...)

Cross-compatibility was worse in the past, and is still an issue,
however it's possible to develop JavaScript code which will run on IE
anf Firefox without too much hassle. Testing in Firefox and porting to
IE usually gives better results as FF is stricter.

I noticed many people use underscore "_" to start variable names. Is
that a style or some kind of compatibility trick?
In OOP, some programmers prefix member variables in an object with "_"
or "m_". Similarly, static members are sometimes prefixed with "s_".
Some firms have guidelines regulating the use of such prefixes, as well
as hungarian notation, etc...

For "private" developers, it's a matter of taste, of habit, etc... It
doesn't have a functionality of its own.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 24 '06 #22
Laurent Bugnion wrote:
pa***********@libero.it wrote:
<snip>
I am studying javascript. I like it, but I am used to tools like
debuggers and intellisense (I work with VS2005/ASP.NET). Is there
something similar for javascript? ...
<snip>
There is some JavaScript Intellisense in Visual Studio 2005, but it's
limited. Since JavaScript is a very flexible language, where you can
add properties to an object on runtime, it's difficult to implement
Intellisense for that language.
<snip>

The ability to add properties to objects at runtime is certainly a
problem for any type of Intelligence. Others include knowing which
objects to report properties for, as without a language defined concept
of what qualifies as a 'class', and with all objects in the langue
being as dynamic as all others, it is difficult for software to see
which structures and objects are implementing the 'class' concept (is a
function that returns a function just a mechanism for doing something
or is it a factory for a class that just happens to use function
objects for its instances?). Another problem is the inconsistencies in
browser DOMs as being told that a document object has a 'styleSheets'
property may tend to promote the writing of code that assumes it does.

Richard.

Aug 24 '06 #23
I still recommend VS2005 for JavaScript development, if only because you
can debug the client and the server in the same application, using the
client-side script debugger and the CLR debugger on the server. It's
really handy to start both sides of an application using F5 and to jump
form one to the other (for example for webservices...)
Wait a moment!
I do have VS 2005. Are you saying that I can take a javascript function
or script file (js) and debug / run it with my VS IDE ? How would that
be exactly achieved?

-Pam

Aug 24 '06 #24
Hi,

pa***********@libero.it wrote:
>I still recommend VS2005 for JavaScript development, if only because you
can debug the client and the server in the same application, using the
client-side script debugger and the CLR debugger on the server. It's
really handy to start both sides of an application using F5 and to jump
form one to the other (for example for webservices...)

Wait a moment!
I do have VS 2005. Are you saying that I can take a javascript function
or script file (js) and debug / run it with my VS IDE ? How would that
be exactly achieved?

-Pam
First make sure that IE has "script debug" enabled:

Internet Properties / Advanced / Disable script debugging must be UNCHECKED

Then, in VS 2005, place a breakpoint in your JavaScript code and press F5.

Alternatively, you can start IE, then choose the menu Debug / Attach to
process. Choose the instance of IE which you want to run the script in,
then click on "Select". Then load the page in the IE, and you can debug
the script.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 24 '06 #25
Infact it was disabled.

THANK YOU Laurent!!!

This piece of information is INVALUABLE to me. I was struggling with
javascript and most of my common errors are due to incorrect typing,
casing. But working within Visual Studio that checks for me and also
shows the variable contents while running, has some intellisense, is
just what I needed. It also check for a lot of other things and helps
getting better organized.

It's all another world :)

Thanks again this really helps a lot.

-Pam

Laurent Bugnion ha scritto:
Hi,

pa***********@libero.it wrote:
I still recommend VS2005 for JavaScript development, if only because you
can debug the client and the server in the same application, using the
client-side script debugger and the CLR debugger on the server. It's
really handy to start both sides of an application using F5 and to jump
form one to the other (for example for webservices...)
Wait a moment!
I do have VS 2005. Are you saying that I can take a javascript function
or script file (js) and debug / run it with my VS IDE ? How would that
be exactly achieved?

-Pam

First make sure that IE has "script debug" enabled:

Internet Properties / Advanced / Disable script debugging must be UNCHECKED

Then, in VS 2005, place a breakpoint in your JavaScript code and press F5.

Alternatively, you can start IE, then choose the menu Debug / Attach to
process. Choose the instance of IE which you want to run the script in,
then click on "Select". Then load the page in the IE, and you can debug
the script.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 24 '06 #26
Hi,

pa***********@libero.it wrote:
Infact it was disabled.

THANK YOU Laurent!!!

This piece of information is INVALUABLE to me. I was struggling with
javascript and most of my common errors are due to incorrect typing,
casing. But working within Visual Studio that checks for me and also
shows the variable contents while running, has some intellisense, is
just what I needed. It also check for a lot of other things and helps
getting better organized.

It's all another world :)

Thanks again this really helps a lot.

-Pam
Happy to help. Note that if Firefox or other Mozilla based browsers are
also in your target list, you want to download Venkman, which is the
JavaScript debugger for this family of browsers.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 24 '06 #27

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

Similar topics

82
by: Peter Diedrich | last post by:
The site design is pretty simple: ============================================ | Head | ============================================ | | ...
1
by: Tony Benham | last post by:
Hi, I've been trying for a while, but I still haven't worked out a way of making a footer appear at the bottom of a webpage, and not at the bottom of the browser window ! See...
3
by: John Crowley | last post by:
I keep running into this over and over again... I want a block server control that renders a header and footer, and child controls in between. But I don't want a templated control, for the...
17
by: Cerebral Believer | last post by:
Hi all, I would like to know how to get two rows of text links to appear at the bottom of a page. Generally I have been using <div> tags with the id attribute and CSS to place blocks of text,...
14
by: Markus Olderdissen | last post by:
each web-page contains header and footer. if the web-page contains more then one page i want to print its header and footer to each page. but header is only printed on first page and footer on last...
13
by: Greg | last post by:
Most suggestions on this topic recommend to use a page footer and make it visible only on the last page. My problem is that the footer is half of the height of a page which means the detail would...
5
by: Annie | last post by:
hello guys, I have a scenario that I am confused about ... I have a number of pages which are using a Master page ... Then I have seperate Footer user control that can reside in master page...
13
Death Slaught
by: Death Slaught | last post by:
I have my entire page in my "main" div. div.main { width: 100%; height: 100%; border: 1px solid gray; } on the left of the page I have a banner.
0
by: raylopez99 | last post by:
keywords: logical coordinates, page coordinates, world coordinates, device coordinates, physical coordinates, screen coordinates, client coordinates. offset rectangle. WYSIWYG rubber rectangle...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.