複製鏈接
請複製以下鏈接發送給好友

checked

鎖定
checked,是一種計算機語言,用於匹配所有選中的複選框元素, 關鍵字用於控制整型算術運算和轉換的溢出檢查上下文。
外文名
checked
概    述
匹配所有選中的複選框元素

目錄

checked簡介

checked 關鍵字用於控制整型算術運算和轉換的溢出檢查上下文。它可以按照下列形式用作運算符或語句。
checked 語句:
checked block
checked 運算符
checked (expression)
其中:
block
包含要在已檢查上下文中計算的表達式的語句塊。
expression
要在已檢查上下文中計算的表達式。注意表達式必須位於括號 ( ) 內。
示例 1
// statements_checked.cs
// The overflow of non-constant expressions is checked at run time
using System;
class OverFlowTest
{
static short x = 32767; // Max short value
static short y = 32767;
// Using a checked expression
public static int myMethodCh()
{
int z = 0;
try
{
z = checked((short)(x + y));
}
catch (System.OverflowException e)
{
System.Console.WriteLine(e.ToString());
}
return z; // Throws the exception OverflowException
}
public static void Main()
{
Console.WriteLine("Checked output value is: {0}", myMethodCh());
}
}
jQuery中使用
checked

checked含義

匹配所有選中的複選框元素

checked返回值

Array<Element>

checked示例

查找所有選中的複選框元素
HTML 代碼:
<form>
<input type="checkbox" name="newsletter" checked="checked" value="Daily" />
<input type="checkbox" name="newsletter" value="Weekly" />
<input type="checkbox" name="newsletter" checked="checked" value="Monthly" />
</form>
jQuery 代碼:
$("input:checked")
結果:
[ <input type="checkbox" name="newsletter" checked="checked" value="Daily" />, <input type="checkbox" name="newsletter" checked="checked" value="Monthly" /> ]