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

NS v. IE

I can move a couple of layers in IE, but they are not moving in NS.
What is wrong with this?

if (NS4)
{
document.word1.left = mv1From;
}
else if (NS6)
{
document.getElementById('word1').style.left = mv1From + "px";
}
else if (IE)
{
document.all.word1.style.left = mv1From + "px";
}

Jul 20 '05 #1
4 3058
Thanks for your response. The objects are:

<div id=word1 style="position:absolute; z-index=3; Left=0; top=5">
<SCRIPT LANGUAGE="javascript">
document.write("'04 election in:");
</SCRIPT>
</div>

<div id=word2 style="position:absolute; z-index:2; Left=90%; top=5">
<SCRIPT LANGUAGE="javascript">
document.write(days + " Days")
</SCRIPT>
</div>

or actually divisions, not layers. I was lazily using a generic name.
Sorry for the confusion.

I had printed the values to the screen so I know the various flags are
set correctly (at least NS6 and IE) as I'm using NS7.

I doubt many people are using NS4 anymore, but I left that in just
because it wasn't hurting anything.

I used your wonderful page (please keep it around a while) to see that
document.body.clientWidth returns the value in both IE and NS. But when
I try to display it with an alert box:

<BODY onload="init()">

<script>

var scrWidth = document.body.clientWidth;
alert("sw " + scrWidth);

it comes up as 0. So all the math is failing and the move not reached.
I do see the proper number when your page is displayed in NS so I
know the browser does see the width.

Now you know why I'm losing my hair.

Lee

Jul 20 '05 #2

"Lee Davidson" <je************@compuserve.com> schrieb im Newsbeitrag
news:3E************@compuserve.com...
Thanks for your response. The objects are:

<div id=word1 style="position:absolute; z-index=3; Left=0; top=5">
<SCRIPT LANGUAGE="javascript">
document.write("'04 election in:");
</SCRIPT>
</div>

<div id=word2 style="position:absolute; z-index:2; Left=90%; top=5">
<SCRIPT LANGUAGE="javascript">
document.write(days + " Days")
</SCRIPT>
</div>


The correct syntax for the inline css is:

style="position:absolute; z-index:3px; left:0px; top:5px"

--
Markus
Jul 20 '05 #3
Lee Davidson <je************@compuserve.com> writes:
Thanks for your response. The objects are:

<div id=word1 style="position:absolute; z-index=3; Left=0; top=5">
Typos in the CSS, you use "=" where you should use ":" and you
have forgotten the units on the value of top, i.e.,

<div id=word1 style="position:absolute;z-index:3;left:0px;top:5px">
<SCRIPT LANGUAGE="javascript">
Should be
<script type="text/javascript">
In HTML 4, the type attribute is mandatory and the language attribute
is deprecated.
document.write("'04 election in:");
</SCRIPT>
</div>

<div id=word2 style="position:absolute; z-index:2; Left=90%; top=5">
As above. You might want to change "left:90%" to "right:0px".
<SCRIPT LANGUAGE="javascript">
As above
document.write(days + " Days")
I assume the "days" variable is initalized earlier.
</SCRIPT>
</div>

or actually divisions, not layers. I was lazily using a generic name.
Sorry for the confusion.
Many people say "layers" about absolutely positionend block elements.
I try to make them stop, partly because it can be confuzed with the
<layer> tag, but mostly because it makes people think that there is
something special about the positioned block. In CSS, it's just a
block like any other.
I had printed the values to the screen so I know the various flags are
set correctly (at least NS6 and IE) as I'm using NS7.
Ok.
I doubt many people are using NS4 anymore, but I left that in just
because it wasn't hurting anything.
As long as it isn't used for anything but NS4, it shouldn't be a
problem.
I used your wonderful page (please keep it around a while) to see that
document.body.clientWidth returns the value in both IE and NS. But
when I try to display it with an alert box: <BODY onload="init()">

<script>
type="text/javascript"

(yes, I'm pedantic :)
var scrWidth = document.body.clientWidth;
alert("sw " + scrWidth);

it comes up as 0.
I can't explain (or reproduce) that. Do you have a link to the page?

Does the page set the broweser in Quirks mode or Standards mode? I
test the values in Standards mode (the only mode one should write new
pages for!), and it might make a difference.

Some value are not initialized until the page is loaded, or at least
contains some content. Your example here gets
document.body.clientWidth before any content is added to the body. I
don't think it matters, it's the height that has that problem, not the
width.

I don't think that is the problem, though (can't reproduce a problem
with it in either Standards or Quirks mode.)
So all the math is failing and the move not reached. I do see the
proper number when your page is displayed in NS so I know the
browser does see the width.
I'm pretty stumped too. Could you give a link to the page, so I can
see it live?
Now you know why I'm losing my hair.


I hear testosterone will do that to you. That's my excuse :)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #4
First, thanks for the help (and Markus that applies to you as well).

Second, I think the lack of objects on the page must have been the
problem as both browsers showed your wonder test page just fine. I
switched from "body" to "documentElement" and it picked up the size.

Third, I have no idea what "Quirks" mode is.

The working page is www.democratsforum.com and the testing page is
www.democratsforum.com/textframe.htm. I put in an "alert" and in IE the
document.body.clientWidth shows as expected, but not in NS.
Yet it does show when printed to the page as in your test position page.

Anyway, it looks as if this is working now (perhaps not in Opera). I
have a friend that uses that one and will ask him to check it out.

Lee

Jul 20 '05 #5

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

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
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: 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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.