开发者

Voodoo magic interfering with my javascript, I am going crazy

开发者 https://www.devze.com 2022-12-16 22:25 出处:网络
Alright, so everything on this website was finished, it all worked, it displayed right enough across all the browsers. For some reason one of the pages isn\'t styling at all, and the javascript isn\'t

Alright, so everything on this website was finished, it all worked, it displayed right enough across all the browsers. For some reason one of the pages isn't styling at all, and the javascript isn't running. The crazy part about this is that every page uses the same CSS file and the same JS file, and the code used across all of them to include the files is exactly the same.

If you visit any of the working pages, and then visit this one, the styling is all messed up, and the javascript doesn't work. However it looks more styled than unstyled. If you refresh once you are on this page (typical response to a page acting up), the next time it loads it is totally unstyled and javascript does nothing.

If you visit the broken page directly, via new window (new tab doesn't cut it sometimes, idkwtf!) it goes straight the the unstyled uglyness.

In Firebug it gives me some crazy Chinese shit, talking about line one of the JS, which, when commented out, still throws an error. In Webkit browsers you don't get the Chinese stuff, but the 开发者_如何学Pythonsame error about line one.

I have no idea. I've tried changing the encoding of the files, but that didn't fix anything/caused more problems. I asked a few developer friends of mine, nobody has a clue. StackOverflow, make me proud, or stupid, whichever works as long as you tell me what in the hell is going on. Be verbose, I want to get to know exactly what caused this to happen very well, because I hate it.


The delinquent page was encoded in UTF-16. Changing it back to UTF-8 fixed it.


You have saved the file as UTF-16, so it loads the css files and scripts as UTF-16 also. Save the file as UTF-8 instead.


I see the problems you describe. FireBug also shows installation.html is messed up. Try copying a working HTML file (e.g. customercare.html) atop installation.html and see what happens.


Your page doesn't validate, maybe that's it.

First of all, add a doctype to your HTML-code and some more content-encoding stuff:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="application/xhtml+xml;charset=utf-8" />
    <meta http-equiv="content-style-type" content="text/css" />
    <link
    (...)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号