分享设置网页背景色等3段代码
2010-10-14 - - 网页设计 - Views
1)兼容ie6、ie7、ff、opera、safari的水平垂直居中
提示:您可以先修改部分代码再运行
2)设置网页背景色
提示:您可以先修改部分代码再运行
3)获取汉字字串所有拼音首字母
<%
function getpychar(char)
tmp=65536+asc(char)
if(tmp>=45217 and tmp<=45252) then
getpychar= "A"
elseif(tmp>=45253 and tmp<=45760) then
getpychar= "B"
elseif(tmp>=45761 and tmp<=46317) then
getpychar= "C"
elseif(tmp>=46318 and tmp<=46825) then
getpychar= "D"
elseif(tmp>=46826 and tmp<=47009) then
getpychar= "E"
elseif(tmp>=47010 and tmp<=47296) then
getpychar= "F"
elseif(tmp>=47297 and tmp<=47613) then
getpychar= "G"
elseif(tmp>=47614 and tmp<=48118) then
getpychar= "H"
elseif(tmp>=48119 and tmp<=49061) then
getpychar= "J"
elseif(tmp>=49062 and tmp<=49323) then
getpychar= "K"
elseif(tmp>=49324 and tmp<=49895) then
getpychar= "L"
elseif(tmp>=49896 and tmp<=50370) then
getpychar= "M"
elseif(tmp>=50371 and tmp<=50613) then
getpychar= "N"
elseif(tmp>=50614 and tmp<=50621) then
getpychar= "O"
elseif(tmp>=50622 and tmp<=50905) then
getpychar= "P"
elseif(tmp>=50906 and tmp<=51386) then
getpychar= "Q"
elseif(tmp>=51387 and tmp<=51445) then
getpychar= "R"
elseif(tmp>=51446 and tmp<=52217) then
getpychar= "S"
elseif(tmp>=52218 and tmp<=52697) then
getpychar= "T"
elseif(tmp>=52698 and tmp<=52979) then
getpychar= "W"
elseif(tmp>=52980 and tmp<=53640) then
getpychar= "X"
elseif(tmp>=53689 and tmp<=54480) then
getpychar= "Y"
elseif(tmp>=54481 and tmp<=62289) then
getpychar= "Z"
else '如果不是中文,则不处理
getpychar=char
end if
end function
function getpy(str)
for i=1 to len(str)
getpy=getpy&getpychar(mid(str,i,1))
'getpy=getpychar(mid(str,1,1))
next
end function
content="中国"
response.write(getpy(content))
%>
关键词 // 代码分享 低一度 网页设计
出处:低一度,链接:http://www.diyidu.cn/post/3code_for_webdesign.html
随机推荐
to "分享设置网页背景色等3段代码"
-
#1 任鸟飞 回复该留言 2010-10-14 11:00:30兼容ie6、ie7、ff、opera、safari的水平垂直居中,我以前也介绍过,关键是原理,想通了就很简单了。
-
没有抢到沙发,来抢个板凳!桶哥分享的技术很好,这3段代码我收下了。
-
没看懂有啥用啊。
-
好文章,百姓维权网来帮顶。
-
第三段不知道可以用在哪里。桶哥 于 2010-10-14 22:36:20 回复第三个可以用来做文章别名等用途。
-
这个板子也很厉害啊!
-
有时间就研究一下了哦。
-
垂直居中我用的是绝对定位加外补丁负值的方法。
-
一直都想系统地学学,无奈总是没能静下心来学。现在的几个网站都是用外面人家的cms做的,美工一塌糊涂,惭愧。有空还得多来向桶哥学习学习啊。
-
哎,都说IE6该死了,但实际上写页面还是得兼顾上。浏览器多了也蛋疼呀。
-
博主的能力好强大!
-
博主的博客真人性化。
-
我觉得IE8的兼容性不是非常好。我博客在IE8之外的浏览器都能正常显示,唯独在IE8下不能,非要在他的兼容模式下才行。
-
恩,不错。学习了!
-
恩,好方法,不错,学习了!


