设为首页 加入收藏

TOP

jQuery入门第二天&&&正则表达式完结篇——仿smarty引擎的制作(三)
2017-10-10 09:54:37 】 浏览:7428
Tags:jQuery 入门 第二 &&& 正则 表达式 完结 smarty 引擎 制作
" /><br />
<button>
Button</button><br />
</form>

<script type="text/java script">
$("#frmTest input:submit").addClass("bg_red");
</script>

--:image图像域选择器

当一个<input>元素的“type”属性值设为“image”时,该元素就是一个图像域,使用:image选择器可以快速获取该类全部元素。

 

<h3>修改表单中图像元素的背景色</h3>
<form id="frmTest" action="#">
<input type="image" src="https://www.cppentry.com/upload_files/article/85/1_7smnl__.jpg" /><br />
<br />
<img alt="" src="https://www.cppentry.com/upload_files/article/85/1_7smnl__.jpg" /><br />
</form>

<script type="text/java script">
$("#frmTest :image").addClass("bg_red");
</script>

--:button表单按钮选择器

表单中包含许多类型的按钮,而使用:button选择器能获取且只能获取“type”属性值为“button”的<input>和<button>这两类普通按钮元素。

 

<h3>修改表单中按钮元素的背景色</h3>
<form id="frmTest" action="#">
<input id="Button1" type="button" value="我是普通按钮" /><br />
<input id="Submit1" type="submit" value="点我就提交" /><br />
<button> 我也是普通按钮 </button><br />
</form>

<script type="text/java script">
$("#frmTest :button").addClass("bg_blue");
</script>

--:checked选中状态选择器

有一些元素存在选中状态,如复选框、单选按钮元素,选中时“checked”属性值为“checked”,调用:checked可以获取处于选中状态的全部元素。

<h3>将处于选中状态的元素设为不可用</h3>
<form id="frmTest" action="#">
<input id="Radio1" type="radio" checked="checked" />
<label id="Label1" for="Radio1">
苹果</label><br />
<input id="Radio2" type="radio" />
<label id="Label2" for="Radio2">
桔子</label><br />
<input id="Checkbox1" type="checkbox" checked="checked" />
<label id="Label3" for="Checkbox1">
荔枝</label><br />
<input id="Checkbox2" type="checkbox" />
<label id="Label4" for="Checkbox2">
葡萄</label><br />
<input id="Checkbox3" type="checkbox" checked="checked" />
<label id="Label5" for="Checkbox3">
香蕉</label><br />
</form>

<script type="text/java script">
$("#frmTest :checked").attr("disabled", true);
</script>

--:selected选中状态选择器

:checked选择器相比,:selected选择器只能获取<select>下拉列表框中全部处于选中状态的<option>选项元素。

<h3>获取处于选中状态元素的内容</h3>
<form id="frmTest" action="#">
<select id="Select1" multiple="multiple">
<option value="0">苹果</option>
<option value="1" selected="selected">桔子</option>
<option value="2">荔枝</option>
<option value="3" selected="selected">葡萄</option&g

首页 上一页 1 2 3 4 下一页 尾页 3/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇PHP模拟发送POST请求之一、HTTP协.. 下一篇CI整合Smarty

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目