Solved

java scrip messes up page centering

Posted on 2011-03-20
5
274 Views
Last Modified: 2012-05-11
hi i have this feature coded in java script that only works if i remove the doc type deceleration from my web page this is fine in firefox as my web page is still centered but in Internet explorer it messes up the web page centering. can any one advise me what i can do to fix this?
0
Comment
Question by:helpchrisplz
  • 4
5 Comments
 
LVL 6

Expert Comment

by:GregArnott
ID: 35177499
Run the javascript through JSLint.

This is an amazing tool which will analyse your JavaScript and tell you how to clean up the code. Using this tool ends up generating code that is compatible across browsers.

As for doctype errors, there's a chance that your errors are coming from how you are linking in the JavaScript into your page not being compatible with the doctype used. I suggest looking at W3Schools DOCTYPE for more information.
0
 
LVL 1

Author Comment

by:helpchrisplz
ID: 35177522
this is needed for the scrip to work and i think its the reason its messing up with the doctype

<body onLoad="javascript:attach_file( 'mysql_insert.php' ) ; show_status('Ready...'); "> <!--atach my php file so its ready for later -->
0
 
LVL 1

Author Comment

by:helpchrisplz
ID: 35177528
i am currently using this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
0
 
LVL 1

Accepted Solution

by:
helpchrisplz earned 0 total points
ID: 35177806
what i had to do is just edit the doctype like this:

<!DOCTYPE HTML PUBLIC >

IE needed a doctype to center the website
but firefox was not likeing the full doctype so the edited one works with both browsers and also now my java script is working :)
0
 
LVL 1

Author Closing Comment

by:helpchrisplz
ID: 35213375
i found the solution
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now