473,394 Members | 1,749 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,394 software developers and data experts.

Javascript failure with I.E. ? [J.S. Expert]

Hi,

Ever had pb with Javascript that works in Fx and not in I.E. ?

I try to have a javascript that position an element in the top of an
HTML Page.
The object is to load the javascipt that will position an HTML content
in the top of the page.

Having a javascript that does this works in I.E. and Firefox.

The problem is to insert a javascipt within this javascipt that works
using I.E.
I use this javascript (my_script.js) :
document.write("<style type=\"text/css\">.style_eco01{top: 0; left: 0;
right: 0; position: absolute; text-align:center;background-
color:#E7E7E7;
width:100%; z-index:9999;} html>body .bandeau_pub {position:
fixed;}</style>");

if (document.all)

{
document.write("<style type=\"text/css\">.style_eco01{left: expression(
( 0
+ ( ignoreMe1 = document.documentElement.scrollLeft ?
document.documentElement.scrollLeft : document.body.scrollLeft ) ) +
'px' );
right: expression( ( 0 + ( ignoreMe2 =
document.documentElement.scrollRight
? document.documentElement.scrollRight : document.body.scrollRight ) )
+
'px' ); top: expression( ( 0 + ( ignoreMe =
document.documentElement.scrollTop ?
document.documentElement.scrollTop :
document.body.scrollTop ) ) + 'px' ); background-color:#E7E7E7;
z-index:9999; position: absolute; width:100%;}</style>");
}

document.write('<div id="pub" class="style_eco01">');
document.write('<scr' + 'ipt LANGUAGE="JavaScript">');
document.write('my_ygm = "top";');
document.write('my_ygm = 336;');
document.write('my_ygm_channel = 01ECO;');
.....
document.write('</scr' + 'ipt>');
document.write('<scr' + 'ipt LANGUAGE="JavaScript"
src="http://my_ygm.com/....js"></scr' + 'ipt>');
document.write('</div>');
This file is called from any html page.
The script works from any html page. Using the firefox browser :
everything is fine.

The problem is with I.E., where the script is positionned in the page
where it is inserted and not on the top of the web page.

The aim is to show the elements in a div on the top of the window.

How do you think this could be done in I.E. ?

We thank you very much for your advise.

Team & Aude

Dec 7 '06 #1
4 1570
Mise en place du service Groupes wrote :
Hi,

Ever had pb with Javascript that works in Fx and not in I.E. ?
Quite always at the beginning. Firefox is using Javascript 1.7, and IE uses
javascript 1.2... so there are a lot of differences...
--
A vrai dire tout le temps, surtout aux débuts, puisque Firefox utilise
la version 1.7 de javascript, alors que IE utilise javascript 1.2
I try to have a javascript that position an element in the top of an
HTML Page.
The object is to load the javascipt that will position an HTML content
in the top of the page.
Why don't you do it with CSS ? There's a way in CSS to tell the div not to be
relative, but rather to have a fixed position, like:
position: fixed;
top: 10px;
left: 100px;
--
Vous devriez essayer avec un fichier CSS plutôt qu'avec javascript. Il y a une
façon plutôt simple de dire à une élement, comme un <divpar exemple, de ne
pas avoir une position relative aux autres élemens, mais une position bien
particulière comme :
position: fixed;
top: 10px; // On positionne à 10 pixels du haut de la fenêtre
left: 100px; // on positionne à 100 pixels à partir de la gauche.

--
Naixn
http://fma-fr.net
Dec 7 '06 #2
VK

Mise en place du service Groupes wrote:
Ever had pb with Javascript that works in Fx and not in I.E. ?
Yep... And vice versa ;-)
I try to have a javascript that position an element in the top of an
HTML Page.
Is it some "Loading..." temporary content? Why not using CSS directly?
The object is to load the javascipt that will position an HTML content
in the top of the page.
Not sure I understood that. Could you explain more?
document.write("<style type=\"text/css\">.style_eco01{top: 0; left: 0;
right: 0; position: absolute; text-align:center;background-
color:#E7E7E7;
width:100%; z-index:9999;} html>body .bandeau_pub {position:
fixed;}</style>");
position: fixed was not invented yet :-) (unless for
background-attachment property). For elements it is
static (default)
relative
absolute

Dec 7 '06 #3

"Mise en place du service Groupes" <od***@netixis.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
Hi,

Ever had pb with Javascript that works in Fx and not in I.E. ?

I try to have a javascript that position an element in the top of an
HTML Page.
The object is to load the javascipt that will position an HTML content
in the top of the page.

Having a javascript that does this works in I.E. and Firefox.

The problem is to insert a javascipt within this javascipt that works
using I.E.
I use this javascript (my_script.js) :
document.write("<style type=\"text/css\">.style_eco01{top: 0; left: 0;
right: 0; position: absolute; text-align:center;background-
color:#E7E7E7;
width:100%; z-index:9999;} html>body .bandeau_pub {position:
fixed;}</style>");

if (document.all)
You could try
<snip>
if(document.all) {
var script=document.createElement("script");
script.type="text/javascript";
script.src="JavaScript/yourScript.js";
document.getElementsByTagName("head")[0].appendChild(script);
}
</snip>

The code should parse as though it were part of the already embedded script.

>
{
document.write("<style type=\"text/css\">.style_eco01{left: expression(
( 0
+ ( ignoreMe1 = document.documentElement.scrollLeft ?
document.documentElement.scrollLeft : document.body.scrollLeft ) ) +
'px' );
right: expression( ( 0 + ( ignoreMe2 =
document.documentElement.scrollRight
? document.documentElement.scrollRight : document.body.scrollRight ) )
+
'px' ); top: expression( ( 0 + ( ignoreMe =
document.documentElement.scrollTop ?
document.documentElement.scrollTop :
document.body.scrollTop ) ) + 'px' ); background-color:#E7E7E7;
z-index:9999; position: absolute; width:100%;}</style>");
}

document.write('<div id="pub" class="style_eco01">');
document.write('<scr' + 'ipt LANGUAGE="JavaScript">');
document.write('my_ygm = "top";');
document.write('my_ygm = 336;');
document.write('my_ygm_channel = 01ECO;');
....
document.write('</scr' + 'ipt>');
document.write('<scr' + 'ipt LANGUAGE="JavaScript"
src="http://my_ygm.com/....js"></scr' + 'ipt>');
document.write('</div>');
This file is called from any html page.
The script works from any html page. Using the firefox browser :
everything is fine.

The problem is with I.E., where the script is positionned in the page
where it is inserted and not on the top of the web page.

The aim is to show the elements in a div on the top of the window.

How do you think this could be done in I.E. ?

We thank you very much for your advise.

Team & Aude
HTH
Vince Morgan
Dec 8 '06 #4
Hy,
In fact my problem is that I need to put an element in the top of an
Html page using a javascript file.
the script <script langage="javascript" type="javascript"
src="myFile.js"></scriptcan be pasted everywhere in an html page, so
it's easier for biginners.

Using
document.write("<style type=\"text/css\">.style_eco01{top: 0; left: 0;
right: 0; position: absolute;
text-align:center;background-color:#E7E7E7; width:100%; z-index:9999;}
html>body .style_eco01 {position: fixed;}</style>");
document.write("<div class=\"style_eco01\">....</div>");
it works very well on IE and Firefox, i can insert everything in my
div...

But I tried t insert script from another .js file inside my div, using
document.write('<div id="id" class="style_eco01">');
document.write('<scr' + 'ipt LANGUAGE="JavaScript">');
document.write('my_ygm = "top";');
document.write('my_ygm = 336;');
document.write('my_ygm_channel = 01ECO;');
.....
document.write('</scr' + 'ipt>');
document.write('<scr' + 'ipt LANGUAGE="JavaScript"
src="http://my_ygm.com/....js"></scr' + 'ipt>');
document.write('</div>');

That works well on Firefox, but on IE, it doesn't go on the top in my
div, it simply goes where
<script langage="javascript" type="javascript"
src="myFile.js"></scriptis pasted...

I tried to use css file, without success...

Do you have an Idea how to solve this problem ?

Thank you very much

Bertrand

Dec 14 '06 #5

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

Similar topics

14
by: Terry A. Haimann | last post by:
I have been working on creating a dynamic web page and have made slow but steady progress. What I have now has an opening page with two drop down boxes. Based on a choice from the first box, the...
41
by: Mr. x | last post by:
Hello, Can I make my java script code be invisible to other people who enter into my site by IE browser ? - How ? Thanks :)
18
by: John D | last post by:
I have a web page that attempts to call a piece of Javascript, which attempts to transform an xml file and an xslt file into Html. The call is here (A) : <script language = "JavaScript" src =...
27
by: C Gillespie | last post by:
Dear All, Hopefully I have a simple problem. Basically, I just want to alter some text with JS. Here is some of my test code: <snip> <script type="text/javascript"> var tmp='a';
3
by: Wendell III | last post by:
Meetroduction (Meetro) is looking for a full-time JavaScript expert. Chicago-based startup seeks an experienced, dedicated and energetic JavaScript programmer to develop components of a robust,...
136
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...
15
by: nikki_herring | last post by:
I am using setTimeout( ) to continuously call a function that randomly rotates/displays 2 images on a page. The part I need help with is the second image should rotate 3 seconds after the first...
20
by: Peter | last post by:
I need a popup alert after a post back. 1) user clicks on the submit button 2) Server side code runs and if the result is false I want to display a java script alert("It did not work") How to...
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.