473,799 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript block alters layout in IE

I just noticed, in IE6, when navagating from one page to another with
the same basic layout (centered top graphic, for example), that a page
with a <script> block in the <head> shifts the HTML contents some number
of pixels to the right.

Other than putting a blank <script> block into each web page, or putting
SCRIPT at the bottom of the BODY, any other way to work around this?

Thanks
Jul 23 '05 #1
5 1517
Steve wrote:
I just noticed, in IE6, when navagating from one page to another with
the same basic layout (centered top graphic, for example), that a page
with a <script> block in the <head> shifts the HTML contents some number
of pixels to the right.

Other than putting a blank <script> block into each web page, or putting
SCRIPT at the bottom of the BODY, any other way to work around this?

Thanks


Post an example or link to one. It's really a CSS question, but I'm
happy to play along...
--
Rob
Jul 23 '05 #2
> Other than putting a blank <script> block into each web page, or putting
SCRIPT at the bottom of the BODY, any other way to work around this?
Thanks


If at all possible, put it inside the <head> block. Then call it from
the HTML by attaching a trigger (such as onmouseover or onclick).

Jul 23 '05 #3
RobG <rg***@iinet.ne t.auau> wrote:
Steve wrote:
I just noticed, in IE6, when navagating from one page to another with
the same basic layout (centered top graphic, for example), that a page
with a <script> block in the <head> shifts the HTML contents some number
of pixels to the right.

Other than putting a blank <script> block into each web page, or putting
SCRIPT at the bottom of the BODY, any other way to work around this?

Thanks


Post an example or link to one. It's really a CSS question, but I'm
happy to play along...


Here's the HTML. If the <script> block is un-commented, the body (with
an image) shifts to the right. As it turns out, this appears to be a
result of using "leftmargin ", which still resides in HTML templates I
wrote years ago before I used CSS. And which I will modify as needed!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Why Does a Script Block Alter Layout?</title>

<!--
<script>
</script>
-->

</head>
<body leftmargin="0" topmargin="0">
<div align=center>
<img src=yourimage.g if>
<br>
<h1>Where am now?</h1>
</div>
</body>
</html>
Jul 23 '05 #4
Steve wrote:
RobG <rg***@iinet.ne t.auau> wrote:

Steve wrote:
I just noticed, in IE6, when navagating from one page to another with
the same basic layout (centered top graphic, for example), that a page
with a <script> block in the <head> shifts the HTML contents some number
of pixels to the right.

Other than putting a blank <script> block into each web page, or putting
SCRIPT at the bottom of the BODY, any other way to work around this?

Thanks


Post an example or link to one. It's really a CSS question, but I'm
happy to play along...

Here's the HTML. If the <script> block is un-commented, the body (with
an image) shifts to the right. As it turns out, this appears to be a
result of using "leftmargin ", which still resides in HTML templates I
wrote years ago before I used CSS. And which I will modify as needed!


I couldn't see any shift at all. I can only suggest that you move to
HTML 4 strict to keep IE (and other browsers) from changing to quirks
mode and replace depreciated attributes (such as the align attribute of
div elements) with CSS.

In any case, you will probably get a better explanation at either:

comp.infosystem s.www.authoring.stylesheets

or

comp.infosystem s.www.authoring.html

--
Rob
Jul 23 '05 #5
Steve wrote:
[...] If the <script> block is un-commented, the body (with
an image) shifts to the right. As it turns out, this appears to be a
result of using "leftmargin ", which still resides in HTML templates I
wrote years ago before I used CSS. And which I will modify as needed!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Why Does a Script Block Alter Layout?</title>

<!--
<script>
</script>
-->
That `script' element, if uncommented, is located within the `head' element,
so it should not have any impact on the layout. However, you are declaring
a deprecated DOCTYPE without system identifier and the `script' element
lacks the `type' attribute which is required since HTML 4.0; this may have
triggered Compatibility Mode which in turn could alter layout.

But it could also be caused by a caching error.
[...]


BTW: As your sender address is forged, this will be my last reply to a
posting of you until further, appropriate changes by you.
PointedEars
Jul 23 '05 #6

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

Similar topics

4
6596
by: Gaz | last post by:
Hi, I need to have a table nested within another table. The tables are alongside each other visually speaking, and the nested table (on the right) can vary in size. My problem is that when the nested table has more rows than the first table, the first table (on the left) pads out its rows so that the table matches the height of the nested table. I don't want this it happen.. I just want the nested table to be longer than the first...
7
1822
by: f1crazed | last post by:
Ok, The following html works wonderful in IE. It does not work in FireFox. Can someone please tell me the work around for FireFox to get this to work. HTML DOCUMENT: <html> <head> <title>CSS Z-order Test</title> <script language=Javascript>
15
4233
by: binnyva | last post by:
Hello Everyone, I have just compleated a JavaScript tutorial and publishing the draft(or the beta version, as I like to call it) for review. This is not open to public yet. The Tutorial is avaliable at... http://www.geocities.com/binnyva/code/javascript/advanced_tutorial/ If any of you could spare the time, please have a look at my tutorial
136
9460
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
2
2218
by: TadPole | last post by:
Hi all, My main problems are::::::::: 1. Set a value within a block container that can be used and changed by subsequent templates/block-containers/tables etc.. 2. get/determine/find the setting that tell the process that the new top of the document region is now at the end of the last block-container used, this must be set in that last block container. 3. find the value used in the 'top" setting on the prior
3
5210
by: axlq | last post by:
I created an experimental page at: http://sunbeam.rahul.net/~unicorn/csstest.html ....which is a standard header + nav bar + 2-column content + footer CSS layout. The left column is 10em wide and contains two block elements: 1. The first block element contains a small table wider than 10em. Yes, I know this particular example doesn't truly need a table. Let's assume it does, that I actually have tabular data to display
11
1821
by: Faisal Vali | last post by:
Hi - I'm new to javascript and I was reading the book Javascript Professional Projects - there is a fragment that has me a little perplexed, and I was wondering if anyone could explain why and how it works. How is it that setting a property to null alters another property? For example setting optionObject.options = null; seems to set optionObject.selectedIndex to -1 automagically. Can you attach "hooks" in javascript that get called...
3
4229
by: Jlcarroll | last post by:
Hi, I am building a web page.and have a simple javascript menu... I call the javascript menu within a div block that my print sytlesheet has set as a display: none;, well all the content in that block doesn't show up, EXCEPT the javascript is still getting run... <div class="menu"> <!--*****************These lines load in the
6
1313
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
Someone refresh my memory. Assuming you are limited to VS 2005, ASP.Net, Javascript, and no Ajax (and no 3rd party controls), is there any way to use Javascript to shift between multiple pages of data without postback? (i.e. something equivalent to tab controls?) (i.e. I thought hiding a component using javascript 'tightened up' the layout but I just realized that's not so. I may be mistakenly thinking of a previous job where we...
0
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10482
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.