checked

checked是計算機語言。

基本介紹

  • 中文名:checked
  • 概述:匹配所有選中的複選框元素
  • 返回值:Array<Element>
  • 屬於:計算機
簡介,含義,返回值,示例,

簡介

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

含義

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

返回值

Array<Element>

示例

查找所有選中的複選框元素
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" /> ]

相關詞條

熱門詞條

聯絡我們