ASP.NET2.0:页面中链入的CSS、js文件带中文时需注意

来源:互联网 发布:sip 绑定本地端口 编辑:程序博客网 时间:2024/06/04 18:23
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
当定义的样式中有中文时,如 .sometyle {font-family:@黑体;},如果书写不正确,如写成 .sometyle {font-family: 黑体;},这应该是个错误的写法,这样不仅这个样式不起作用,而且还会影响到定义在它后面的样式起作用,不知道对CSS的解析本来就是这个规则,还是ASP.NET 2.0的问题。
当你直接把从网上download下来的js文件加入的VS2005项目中时,如果此文件中带中文,当你调用其方法时,就会出现对象找不到的js错误,就像你没有链如该文件一样。你需要在项目中新建一个js文件,然后把你down下来的文件中的代码copy进这个新文件,然后使用这个新建的文件。这个问题应该是文件编码的问题。
另外,ASP.NET2.0 采用的是XHTML 1.0标准,而之前1.x是HTML 4.0, 从两者HTML源文件头中可以看出
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
所以定义元素是要符合XHTML 1.0规范,比如长度都要加好单位,如width:100px;width:100不起作用。

http://zhouruifu.cnblogs.com/archive/2006/06/09/421522.html

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击