以下是我编写的VBScript脚本里的脚本导入程序,相信是你说的那种功能。mBtl_CodeLib_ScriptLoad就是实现这个功能的函数。'[脚本导入函数] Function mBtl_CodeLib_ScriptLoad(pURL,pWindow) '功能:导入指定脚本到指定窗口对象。 '参数:pURL 指定Script文件的地址。 ' pWindow 导入该要素的目的窗口对象。 Set tOutObj=mBtl_CodeLib_ScriptObjCreateByURL(pURL,pWindow) pWindow.document.body.insertBefore tOutObj End FunctionFunction mBtl_CodeLib_ScriptObjCreateByURL(pURL,pWindow) '功能:在指定窗口对象创建一个VBScript的script要素。该要素指定src属性为pURL。 '参数:pURL 指定Script文件的地址。 ' pWindow 创建该要素的目的窗口对象。 Set tOutObj=pWindow.document.createElement("script") With tOutObj .language=mBtl_CodeLib_SystemScriptLanguage .type="text/" & mBtl_CodeLib_SystemScriptLanguage .src=pURL End With Set mBtl_CodeLib_ScriptObjCreateByURL=tOutObj End Function
注意:上面我给你的函数有一个错误。以上函数是在我的函数库里抓来的,mBtl_CodeLib_SystemScriptLanguage这个变量是我的函数库里特有的,如果你要单独使用一定要改一下:把: With tOutObj .language=mBtl_CodeLib_SystemScriptLanguage .type="text/" & mBtl_CodeLib_SystemScriptLanguage .src=pURL End With改成: With tOutObj .language="VBScript" .type="text/" & "VBScript" .src=pURL End With
document.write("<script>alert('这是第层JS的函数');</"+"script>");
</script>
注意:"<script>.....</script>" 要写成:"<script>.....</"+"script>"
<script language="javascript" src="testjs.js"></script>2. testjs.js:
document.write ("<script language=\"javascript\" src=\"testjs2.js\"></script>");
alert("in testjs.js");3. testjs2.js:
alert("in testjs2.js");
Function mBtl_CodeLib_ScriptLoad(pURL,pWindow)
'功能:导入指定脚本到指定窗口对象。
'参数:pURL 指定Script文件的地址。
' pWindow 导入该要素的目的窗口对象。
Set tOutObj=mBtl_CodeLib_ScriptObjCreateByURL(pURL,pWindow)
pWindow.document.body.insertBefore tOutObj
End FunctionFunction mBtl_CodeLib_ScriptObjCreateByURL(pURL,pWindow)
'功能:在指定窗口对象创建一个VBScript的script要素。该要素指定src属性为pURL。
'参数:pURL 指定Script文件的地址。
' pWindow 创建该要素的目的窗口对象。
Set tOutObj=pWindow.document.createElement("script")
With tOutObj
.language=mBtl_CodeLib_SystemScriptLanguage
.type="text/" & mBtl_CodeLib_SystemScriptLanguage
.src=pURL
End With
Set mBtl_CodeLib_ScriptObjCreateByURL=tOutObj
End Function
其实我只是想问问JAVASCRIPT本身是不是就有个函数啊什么的来做这个
不过还是要多谢大家
分分罗:)
With tOutObj
.language=mBtl_CodeLib_SystemScriptLanguage
.type="text/" & mBtl_CodeLib_SystemScriptLanguage
.src=pURL
End With改成:
With tOutObj
.language="VBScript"
.type="text/" & "VBScript"
.src=pURL
End With