Solved

java scrip messes up page centering

Posted on 2011-03-20
5
285 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

911 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

26 Experts available now in Live!

Get 1:1 Help Now