ClientScriptItem(String, String, String, String, String) 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
使用提供的参数初始化 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 为空(由设计宿主引发)。
注解
使用 text 或 source 参数初始化 对象的语句ClientScriptItem, (不能同时) 。 用于 text 使用包含 语句的输入字符串初始化脚本。 或者,使用 source 通过包含脚本语句的路径初始化脚本。
可以将任何输入参数指定为 null ,或指定空字符串 (“”) ;相应的属性是使用输入值设置的 script ,而元素是在没有该属性的情况下生成的。 使用 null 或空字符串 (“”) 将生成以下结果:
对于
text,相应的script元素不包含脚本语句。对于
source,未在src元素中script设置 属性。对于
language,未在language元素中script设置 属性。当客户端脚本块未指定脚本语言时,客户端浏览器将确定语言。
对于
type,type未在 script 元素中设置 属性。当客户端脚本块未指定脚本类型时,客户端浏览器将确定类型。
对于
id,设计主机 (例如 Visual Studio 2005) 将引发 ArgumentNullException。