共用方式為


ClientScriptItem(String, String, String, String, String) 建構函式

定義

使用提供的參數初始化 ClientScriptItem 類別的新執行個體。

public:
 ClientScriptItem(System::String ^ text, System::String ^ source, System::String ^ language, System::String ^ type, System::String ^ id);
public ClientScriptItem (string text, string source, string language, string type, string id);
new System.Web.UI.Design.ClientScriptItem : string * string * string * string * string -> System.Web.UI.Design.ClientScriptItem
Public Sub New (text As String, source As String, language As String, type As String, id As String)

參數

text
String

script 項目的內容;要在用戶端上執行的指令碼陳述式字串。

source
String

src 項目的 script 屬性值,指定用戶端指令碼內容的外部來源位置。

language
String

language 項目的 script 屬性值,指定指令碼陳述式的語言。

type
String

script 項目的類型屬性值,表示關聯之指令碼引擎的 MIME 類型。

id
String

script 項目的 ID。 設計主機 (需要這個引數,例如 Visual Studio 2005) 。

例外狀況

id 為 null (由設計主應用程式擲回)。

備註

使用 textsource 參數來初始化 物件的語句 ClientScriptItem , (不是兩者) 。 使用 , text 使用包含 語句的輸入字串來初始化腳本。 或者,使用 source 以包含腳本語句的路徑初始化腳本。

您可以將任何輸入參數指定為 null 或空字串 (「」「) ;對應的屬性是使用輸入值來設定,而且 script 專案是在不使用該屬性的情況下產生。 使用 null 或空字串 (「」「) 會產生下列結果:

  • 針對 text ,對應的 script 專案不包含腳本語句。

  • 針對 sourcesrc 屬性不會在 script 專案中設定。

  • 針對 languagelanguage 屬性不會在 script 專案中設定。

    當用戶端腳本區塊未指定指令碼語言時,用戶端瀏覽器會決定語言。

  • 針對 typetype 屬性不會在腳本專案中設定。

    當用戶端腳本區塊未指定腳本類型時,用戶端瀏覽器會決定類型。

  • 例如,針對 id ,設計主機 (Visual Studio 2005) 會擲回 ArgumentNullException

適用於

另請參閱