0

My problem can be found http://www.hykao.com/bbs/defaultpage.php, which can not get a right html structure. I have made great effort trying to find out why, but I can not. IS there any one willing to help?

You can check the sourcecode in firefox for example, and will get the following lines colored red:

<!DOCTYPE html>
<html>
<head>
....
</head>
<body id="nv_defaultpage" class="pg_view" onkeydown="javascript:if(event.keyCode==27){return false;}">

and also, in firebug's HTML option panel, I get html's head empty: , and other meta info all inside the body.

Thanks a lot if you can help.:-)

pinocchio
  • 71
  • 7
  • 1
    It looks fine. HTML head has several lines e.g. ` 汉语考研网-汉语国际教育硕士论坛 - Powered by Discuz!`. Not sure what exactly is the problem. – Yogendra Singh Nov 04 '12 at 06:20
  • @EdHeal my problem is: I wrote html code as the html rule goes, but the browser seems not to recognize and parse it right. I can not find out why. – pinocchio Nov 04 '12 at 06:41
  • Both Firefox and IE seem to be OK. Use view source code and it looks correct. However using Firebug it seems wrong. See answer below. – Ed Heal Nov 04 '12 at 06:52

2 Answers2

0

The source code on your site, you've got all the meta tags and title tag in the body of the document, they should be in between {<head></head>}

crs1138
  • 926
  • 1
  • 12
  • 23
  • Yes, I know that, and I exactly wrote these meta tags between the head tag. But when the browser resolve the code, the head becomes empty. There is something strange beyond I can detect. – pinocchio Nov 04 '12 at 06:39
  • Just looking at the souce code this is incorrect. head runs from line 3 through to 25, body the rest. Between those lines is the meta tage. – Ed Heal Nov 04 '12 at 06:40
  • Do you use any DOM manipulation? – crs1138 Nov 04 '12 at 06:51
  • @EdHeal I dont quite understand you. what do u mean by "Between those lines is the meta tage. " In my source code as u can see, head part runs from line 3 to 25, all meta tags are written within head. why firebug get these meta tags removed from into body part? – pinocchio Nov 04 '12 at 06:53
  • @EdHeal I was debugging a style problem on IE at the begining: http://www.hykao.com/bbs/defaultpage.php should have the same centered effect as hykao.com/bbs/picnews.php?mod=detail&pic=4, but it doesn't. Then I check it with firebug and found their html structure seem to be different. – pinocchio Nov 04 '12 at 07:07
  • @Pinocchio - See update of message – Ed Heal Nov 04 '12 at 07:23
  • @EdHeal Thanks a lot for your help. Problem solved at last! A php file of UTF-8 without BOM included by another php file caused this strange problems. I tried several time, when I remove that included file, meta tags' position is right; when i add it, bug again! Although I can still not tell exactly I believe there is some relation between BOM and tag position of the output html file. – pinocchio Nov 04 '12 at 08:42
  • @pinocchio - Ok. You could also add give me some credit to my reputation – Ed Heal Nov 04 '12 at 08:46
0

I think your problem is that the character set that you are using is confusing Firebug. Viewing page source eveything seems ok.

So you need to get the server HTTP headers to be correct. It serves up

HTTP/1.1 200 OK
Date: Sun, 04 Nov 2012 06:40:48 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET, PHP/5.2.6
Content-Type: text/html; charset=utf-8
Set-Cookie: 3k5v_2132_lastact=1352011248%09defaultpage.php%09; expires=Mon, 05-Nov-2012 06:40:48 GMT; path=/
Set-Cookie: 3k5v_2132_sid=NClcY6; expires=Mon, 05-Nov-2012 06:40:48 GMT; path=/
X-Cache: MISS from 118.192.42.168
X-Cache-Lookup: MISS from 118.192.42.168:80
Via: 1.0 118.192.42.168 (squid/3.0.STABLE25)
Transfer-Encoding: chunked

And

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

In the HTML header. You need to use unicode. i.e. utf-16.

EDIT

There is nothing wrong with the HTML. Firebug is getting confused.

See below

Viewing the source - i.e. stuff that the server set

Firebug - that is incorrect as I think that it is getting confused with you not using UTF-16

Ed Heal
  • 59,252
  • 17
  • 87
  • 127
  • Thank u very much. I have another page, http://www.hykao.com/bbs/picnews.php?mod=detail&pic=4. All things in these page seem to be working fine. Maybe there is something wrong with charset, but it's hard to detect. – pinocchio Nov 04 '12 at 06:57
  • Still not work when charset is change into utf-16. My original charset is utf-8, cause chinese characters are used a lot. :) – pinocchio Nov 04 '12 at 07:20
  • @pinocchio - You need to also change the HTTP headers as well as the HTML. You'll need to look that up – Ed Heal Nov 04 '12 at 07:25
  • See http://stackoverflow.com/questions/9781157/how-to-set-iis-websites-default-encoding – Ed Heal Nov 04 '12 at 07:29