默认传值:get传值根据name属性 直接传到URL
post传到表单数据中
<from action="Onload.html" method="get">
<input type="text" name="Name" value="" />
<input type="password" name="pwd" value="" />
<input type="password" name="" value="" />
<input type="submit" name="" value="提交" />
<from>
jQuery事件
常用简单事件 bind,on,off,one,unbind,trigger,triggerHandler
高级事件 live ,die ,hover ,toggle ,delegate ,undelegate
$(function () {
//$("span").click(function () {
// $(this).css("color", "red");
//})
//$("span").mouseover(function () {
// $(this).css("color", "red");
//})
$("span").bind("click mouseover",function() { //bind事件可以合并同一效果的两个事件
$(this).css("color", "red");
})
})
阻止事件冒泡使用stopPropagation方法
阻止默认行为使用preventDefault方法
$(function(){
$("a").bind("click",function(e){
alert("a单击事件");
//window.event.cancelBubble = true;
e.preventDefault();//阻止打开链接
e.stopPropagation();
});
$(document).click(function(){
alert("document单击事件");
});
动画
$("button").click(function(){
$("div").show(500,function(){ //显示
$(this).hide(500); //隐藏
});
$("div").slideUp(1000,function(){ //上出
$(this).slideDown(1000); //下出
});
$("div").slidetoggle(1000); //上下循环
})
})