HTML&javaSkcript&CSS&jQuery&ajax(九)
一、HTML
1、单选按钮 <form action="><inpput type="radio" name="sex" value="male" >Male</br> <input type="radio" name="sex" value="female">Female</form>
2、复选框 <form action="><inpute type="checkbox" name="vehicle" value="Car">I have a Car</form>
3、下拉列表 <form action=""><select name="car"><option value="volo">Volo</option><option value="fita">Fita</option></select></form>
如果设置某项选定直接 <option value="fem" selected>fem</option>
4、设置文本域 <textarea rows="12" cols="33"></textarea> 创建按钮 <input type="button" value=Helloworld">
5、<iframe src="demo_iframe.html" name="iframe_a"></iframe>
<p><a href="http://www.runoob.com" target="iframe_a">Runnob.com</a></p>因为a 标签的target属性名是inframe_a的iframe框架,点击链接后页面会在iframe 中出现。
6、脚本 JavaScript <p id="demo">JavaScriptkeyi 可以触发时间</p>
<script> function myfunction(){
document.getElementId("demo").innerHTML="Hello JavaScript";}</script>
<button type="button" onclick="myfunction()">点击</button>
改变样式,<script> function myFunction(){
x=document.getElementById("demo")
x.style.color="3ff0000";}</script> <button type="button onclick="myfunction()"></button>
7、占位符  , HTML 统一资源定位器, uniform Resource locators
HTML5中对于多媒体的设置, <video width="320" height="240" controls><source src="movie.mp4" type="video/mp4"><source src="movie.ogg" type="video/ogg"></video>
8、<srcipt>document.createElement("myHero")</script> <style> myHero{
dispaly:block;
background-color:#ddd;
padding:50px;
font-size:30px;}</style> <myHero> 我的因元素</myHero>
9、canvas 标签定义画布, <canvas id="myCanvas" width="200" height="100" style="border:1px solid #000000;">
用JavaScript绘图 <canvas id ="myCanvas" width="200" height="100" style="brorder:1px; solid #3c3c3;"></canvas >
<.script> var c=document.getElement.ById("myCanvas"); var ctx=c.getContext("2d");
ctx.filStyle="#FF0000"; ctx.fillRect(0,0,150,75);</script>
10、使用 canvas画布画一条线 <canvas id="myCanvas" width="100" height="100" style="border:1px solid #d3dd3d3;"></canvas>
<script> var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.moveTo(0,0);
ctx.lineTo(500,400);
ctx.stroke();</script>
11、使用canvas画一个圆 <canvas id-""myCanvas" width="200" height="100" style="border: 1px solid 3d3d3d3;"></canvas>
<script> var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.beginPath();
ctx.arc(95,50,40,0,2*Math.PI);
ctx.stroke();</script>
12、使用canvas 画出实心字体 <canvas id="myCanvas" width="200" height="100" style="broder:1px solid #d3d3d3";></canvas>
<script> var c=document.getElementById("myCanvas");
var ctx.c.getContext("2d");
ctx.font="30px Arial"; ctx.fillText("Hello World” ,10,50);</script> 如果是画的空心花园 修改成 ctx.strokeText("Hello world " 10,50);
13、 cavans 颜色渐变 两种方法创键渐变 createlinearGradient(x,y.x1,y1)创键线条渐变
createRadialGradient(x,y,r,x1,y1,r1)创键一个径向圆渐变
画布都一样这里不再赘述, 直接在画布上绘制如下:
<scrippt>
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
var grd=ctx.createLinearGradient(0,0,200,0);
grd.addColorDtorp(0,"red");
grd.addColorStop(1,"black");
ctx.filStyle=grd; ctx.fillRect(10,10,150,80);</script>《!--这里如果是径向型渐变 只需要修改函数ctx.createRadialGradientI(0,0,200,1)》
14、 将图像放在画布上面 <img id="scream" src="img_the_scream.jpg" alt="The Scream" width="200" height="100">
<canvas id="myCanvas" width="100" height="100" style="border: 1px solid 3d3d3d3;"></canvas>
<script> var c=document.getElementById("muCanvas");
var ctx=c.getContext("2d");
var img=docment.getElementById("scream");
img.onload=function(){
ctx.drawImage(img,10,10);}</script>