简体   繁体   English

巫毒魔术干扰了我的JavaScript,我快要疯了

[英]Voodoo magic interfering with my javascript, I am going crazy

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. 由于某种原因,其中一个页面根本没有样式,并且javascript无法运行。 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. 疯狂的是,每个页面都使用相同的CSS文件和相同的JS文件,并且所有页面所使用的包含文件的代码完全相同。

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. 如果您访问任何一个工作页面,然后再访问该页面,则样式都被弄乱了,JavaScript无法正常工作。 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. 如果您刷新后进入此页面(通常是对某个页面的反应),则下次加载该页面时,它将完全没有样式设置,并且javascript不会执行任何操作。

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. 如果您直接通过新窗口访问破碎的页面(有时新标签页不会剪切它,idkwtf!),它将直接显示未样式化的丑陋状态。

In Firebug it gives me some crazy Chinese shit, talking about line one of the JS, which, when commented out, still throws an error. 在Firebug中,它给了我一些疯狂的中文提示,谈论的是JS的第一行,当注释掉时,仍然抛出错误。 In Webkit browsers you don't get the Chinese stuff, but the same error about line one. 在Webkit浏览器中,您看不到中文内容,但是关于第一行的错误相同。

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. 只要您告诉我到底发生了什么,StackOverflow会让我感到骄傲或愚蠢,无论哪种方法都能奏效。 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. 违约页面以UTF-16编码。 Changing it back to UTF-8 fixed it. 将其更改回UTF-8可修复该问题。

You have saved the file as UTF-16, so it loads the css files and scripts as UTF-16 also. 您已将文件另存为UTF-16,因此它也将CSS文件和脚本加载为UTF-16。 Save the file as UTF-8 instead. 而是将文件另存为UTF-8。

I see the problems you describe. 我看到您描述的问题。 FireBug also shows installation.html is messed up. FireBug还显示installation.html混乱。 Try copying a working HTML file (eg customercare.html) atop installation.html and see what happens. 尝试将一个有效的HTML文件(例如customercare.html)复制到installation.html上面,然后看看会发生什么。

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: 首先,在您的HTML代码中添加一个doctype以及其他一些内容编码的内容:

<?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
    (...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM