按一下以給予評分及指教
MSDN
MSDN Library
.NET 開發
先前版本
類別庫參考
System.Web
 HtmlAttributeEncode 方法 (String)

  開啟低頻寬檢視
本頁僅適用於
Microsoft Visual Studio 2005/.NET Framework 2.0

其他版本也適用於下列軟體:
.NET Framework 類別庫
HttpUtility.HtmlAttributeEncode 方法 (String)

以最簡化的方式將字串轉換為 HTML 編碼的字串。

命名空間: System.Web
組件: System.Web (在 system.web.dll 中)

Visual Basic (宣告)
Public Shared Function HtmlAttributeEncode ( _
    s As String _
) As String
Visual Basic (使用方式)
Dim s As String
Dim returnValue As String

returnValue = HttpUtility.HtmlAttributeEncode(s)
C#
public static string HtmlAttributeEncode (
    string s
)
C++
public:
static String^ HtmlAttributeEncode (
    String^ s
)
J#
public static String HtmlAttributeEncode (
    String s
)
JScript
public static function HtmlAttributeEncode (
    s : String
) : String

參數

s

要編碼的字串。

傳回值

編碼的字串。

HtmlAttributeEncode 方法只會將引號 (")、連字號 (&) 和左角括弧 (<) 轉換成對等的字元實體。它的速度比 HtmlEncode 方法快許多。

HtmlAttributeEncode 方法所產生的字串,僅可用於雙引號括住的屬性 (Attribute)。將 HtmlAttributeEncode 方法與單引號括住的屬性搭配使用時,可能會發生安全性問題。

Windows 98、 Windows 2000 SP4、 Windows Server 2003、 Windows XP Media Center Edition、 Windows XP Professional x64 Edition、 Windows XP SP2、 Windows XP Starter Edition

.NET Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱系統需求一節的內容。

.NET Framework

支援版本:2.0、1.1、1.0
社群內容   什麼是社群內容?
新增內容 RSS  註解
Processing
© 2009 Microsoft Corporation. 著作權所有,並保留一切權利。 使用規定  |  商標  |  隱私權聲明
Page view tracker