网络程序设计要点
第一章:html
第二章:样式文件css
第三章:div
第四章:交互控件
第五章:菜单和文件操作
第六章:asp.net数据库操作
<html></html><body></body><head></head>
html文件由head和body两部分组成;
链接:<a href="" target="_blank/_self/框架名" ></a>
嵌入图片:<img src=".jpg" alt="" title="">
嵌入视频:<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="960" height="110">
<param name="movie" value="5.swf"/>
<param name="quality" value="high"/>
</object>
<embed src="" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"width="960"height="110" >
</embed>
框架:<iframe id="" name="" width="100%" height="100%" frameborder="0" src="1.1.html"(默认的框架内的内容)></iframe>
表格:<table border="" align=""><tr><td colspan= rowspan=""></td><th align="" width="" height="" backgrond=""></th></tr></table>
横线标签:<hr color="" width="" size="">
空格:&nqsb;
标题:<h1 align=""></h1> 网页标题:<title></title>
段落:<p></p>
样式:1.标志内样式:<style="font-size:10pt;font-family:"";font-weight:"bolder"">;
2.页面内样式:</head>之前<style type="css/text"><!--h1{}--></style>;
3.网站样式:<link href="" rel="stylesheet/text">
两种列表:数字化编号列表:<ol type="1" start="3" style=""><li></li></ol>
圆心无序列表:<ul type=circle style=""><li></li></ul>
css:body{background-image:url()}
A:link{font-family:;font-size:;font-weight:;color:};
A:visited{};
A:hover{};
A:active{};
类:定义时:.类名 访问时:class=;
对象:# id=
div:在样式中定义样式;#div{height:490px;width:100px;left:0px;top:80px;background-color:#F2FAD1 ;border:10px solid #CCFF00;float:left;}
使用时:<div id=""></div>;
正则表达式:在输入控件加个事件onblur="testValid(/^[0-9]{6}$/,"无效时的提示",this.value)"
function testValid(regexp,msg,thisvalue) {
var validRes=thisvalue.match(regexp);
if (!validRes) { alert("值:"+thisvalue+",不满足正则表达式"+
regexp+"的要求,\n应该是"+msg);
return false; }
else {return true; }
}
特殊效果:
文字图片滚动:<marquee behavior=alternate direction=left/right (up/down必须指定height) scrolldelay=500></marquee>
背景:background-image:url();background="";
背景重复:background-repeat:repeat-x/no-repeat/repeat;
背景固定:background-attachment:fixed;
背景颜色:background-color:red;
皮肤切换:<select size="1" onchange="selectSkin(this.value)">
<option value="1.css">第一套皮肤</option>
<option value="2.css">第二套皮肤</option>
<option value="3.css">第三套皮肤</option></select>
<script language="javascript">
function selectSkin(thisValue){document.getElementById("selfCss").href=thisValue;}
</script>
<link href="1.css" rel="stylesheet" id="selfCss">
交互控件:
提示<input name="" id="" type="text/radio/checkbox/reset/submit/button" value="" >
提示<select name="" id=""size="" ><option selected value=""></option><option value=""></option></select>
性别<INPUT type="radio" name="yourSex" id="yourSexMan" value="1" checked >男
<INPUT type="radio" name="yourSex" id="yourSexFemale" value="0">女<br>
学历<SELECT name="yourDegree" id="yourDegree" size="4">
<OPTION selected value=1>专科</OPTION>
<OPTION value=2>本科</OPTION>
<OPTION value=3>硕士</OPTION>
<OPTION value=4>博士</OPTION>
<OPTION value=5>博士后</OPTION>
</SELECT></br>
提示<textarea name="" id="" cols="" rows=""></textarea>
菜单:<img src="" onclick="downClick("")">用链接来实现,链接对象(下一级菜单,绝对定位:position:absolute)放在div中,编写函数进行控制:document.getElementById("menu").style.display="none/block",并指定两个属性:style.left,style.top=10;
function downClick(blockName)
{
hiddenAll();//关闭所有下拉菜单
document.getElementById(blockName).style.display="block";
//20为顶行菜单的高度
document.getElementById(blockName).style.left=10;
document.getElementById(blockName).style.top=100;
}
function hiddenAll()
{
document.getElementById("menu").style.display="none";
}
<div id="menu" style="display:none;POSITION:absolute">
<input type=button value="大纲" onclick="document.getElementById('rw').src='http://wenku.baidu.com/view/07033d2e7375a417866f8f3c.html';hiddenAll();" ><br>
<input type=button value="日历" onclick="document.getElementById('rw').src='http://wenku.baidu.com/view/2003ac0f76c66137ee0619f5.html';hiddenAll();" ><br>
</div>
文件操作:
fun(){
var myfso=new ActiveXObject("Scripting.FileSystemObject");创建文件操作器函数
var myFile;
try{
if(myfso.FileExists(myFileName)==true){检查文本文件存在函数
myFile= myfso.OpenTextFile(myFileName,8,true);打开文本文件函数
}
else{
myFile=myfso.CreateTextFile(myFileName,true);创建文本文件函数
}
myfile.close();关闭文件函数
}
cath(err){
alert("无法完成操作!原因是:"+err);
}
}
表单标签:<form></form>
将从表单获取的信息在多行文本中显示出来,document.getElementById("output").value="要显示的内容";
将从表单获取的信息在div中显示出来,document.getElementById("").InnerHTML="要显示的内容";
asp.net数据库操作:
将数据写入数据库中:mycmd.CommandText=string.Format("INSERT INTO nameList(name,password,studsex,favior1,favior2,favior3,favior4,studHistory,studDegree)"+"values('{0}','{1}','{2}',{3},{4},{5},{6},'{7}',{8})",yourName,yourPw,yourSex,favior1,favior2,favior3,favior4,yourHistory,yourDegree);
mycmd.ExecuteNonQuery();
从数据库读取数据: mycmd.CommandText=string.Format("SELECT * FROM nameList WHERE name='{0}',yourName");
SqlDataReader mydr=mycmd.ExecuteReader();
字符串: mycmd["password"].ToString().Trim();数字:Int16.parse(mycmd["favior1"].ToString());

浙公网安备 33010602011771号