Showing posts with label 网页设计Web design. Show all posts
Showing posts with label 网页设计Web design. Show all posts

Friday, October 20, 2006

Add some javascript codes to limit bad posts

The post platform of my Company website got many bad messages which were prohibited by the goverment. So I add some simple code in the page to limit these bad messages posted in our site. Write down the words you don't want in the first line, spiting them with "|"


var kws = "XXX|XXX|XXX";
function check(theForm)
{
if (eval("/"+kws+"/gi.test(theForm.product1.value)"))
{alert("Your content includes bad words"); return false;}

else if (eval("/"+kws+"/gi.test(theForm.product.value)"))
{alert("Your content includes bad words"); return false;}

else if (eval("/"+kws+"/gi.test(theForm.memo.value)"))
{alert("Your content includes bad words"); return false;}

else return true;
}

Tuesday, October 10, 2006

用CSS实现网页居中--终于搞懂了,心喜

一直很喜欢用CSS做网页,却搞不懂怎样实现网页居中,毕竟做出来的网页要适应不同的分辩率的浏览器阅读.
今天终于搞懂了.方法原来很简单,就是将<body>内的所有内容用一个<div id="wrap"></div>装起来,定义一个类,如#wrap。在CSS样式表里设置
#wrap{width:800px;margin-left:auto;margin-right:auto;background:#efefd5;} 就可以了。这里面最重要的是margin-left:auto;margin-right:auto;这一句,如果取消了,网页就成了默认的左对齐了。

在<div id="wrap"></div>包含的其他<div></div>可以随心所欲地设置它们的位置float:left 或float:right,它们都将在800宽的盒子里浮向左,或浮向右边,同时还可以设置margin,调整与<div id="wrap"></div>边界的距离。

搞懂了这个真是满心欢喜。从此以后,我就可以用Dreamweaver的页面设计(CSS)模板,修修改改就成了。用CSS给网页布局时,给ID,Class起名字最累人了。
许多人一定早就会了,可能还有人像我这样不是很清楚的吧。希望他们能看到这篇blog,得到些启发。表达能力有限,看不明白的话,留个言发问吧。
越来越喜欢用blog做日记本了。以前总是随便用个纸片记住一些想法,过后要不就揉成一团,要不就不知所踪懒于整理,更不用说查找参考了。如果记在电脑硬盘里呢,也会不知所踪,不知是在家里的电脑,还是办公室的,还是在笔记本里。现在写在blog里,分类明确,过后还可不断追加修改,随时查阅。公诸同好,可能还会帮助别人。真是一举数得。

Monday, August 21, 2006

3D bar效果



这些图都是用渐变做出3D效果。虽然用3Dmax可以轻易地画出3D规则形状,但是凹凸,镶嵌效果必须精确地计算,绘制,切削物体,最后还要打光,这个过程令人痛不欲生。用PS绘制这样的3D效果关键在于用方向互为相反的渐变。