I've build a website for a client and as we all know 'it works just fine on my machine' :-)开发者_如何转开发 as it does on several machines at my clients location. But they have (so far) 3 pc's on wich some errors occur, like cannot find ElementById. These machines are normal up-to-date windows machines running IE8.
When comparing the html-source of the page on my machine with one of a machine on wich the error occurred I found that there seems to be a s--tload of html injected. Loads of DIVS and SPAN around attributes and elementID's and even javascript :
Normal:
<script type="text/javascript" language="JavaScript">
After injection:
script will be surrounded with a SPAN tag using class 'HTML_ELM'
type will be surrounded with a SPAN tag using class 'HTML_ATR' "text/javascript" will be surrounded with a SPAN tag using class 'HTML_VAL'<<span class="HTML_ELM">script</span> <span class="HTML_ATR">type</span>=<span class="HTML_VAL">"text/javascript"</span> <span class="HTML_ATR">language</span>=<span class="HTML_VAL">"JavaScript"</span>>
even ID's of html elements are surrounded with these SPAN tags (class='JS_STR'
) probably causing the problem of cannot find ElementById
I have no idea why this is happening, I also cannot find a cause on Google when searching for these weird classnames used by the injected SPAN
/HTML
tags (HTML_VAL
, HTML_ELM
, HTML_VAL
).
Does anyone here know what could be causing this ?
many thanks, Jurjen.
Well, since you are running IE8, are some of the machines in compatibility mode?
This extra code comes from the IE8 source viewer. In IE8, if you view source and go to the File menu there are two options under Save, HTML Source and Formatted HTML View. The Formatted HTML View contains all the extra code you are seeing.
Do your HTML files start with a valid DTD ? like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Try running it through html-tidy.
An online tidier can be found at http://infohound.net/tidy/.
Then, it'll be easier to track down the problem. It sounds like malformed html.
Googling span class=HTML_ELM returns lots of results but they've got nothing much in common.
You don't have a syntax highlighter script (or something similar) running on the site by any chance?
精彩评论