此处将为大家介绍关于asp-classic–带参数的vbscript:getref的详细内容,并且为您解答有关vbsfunction参数的相关问题,此外,我们还将为您介绍关于2011-08-03Mus
此处将为大家介绍关于asp-classic – 带参数的vbscript:getref的详细内容,并且为您解答有关vbs function参数的相关问题,此外,我们还将为您介绍关于2011-08-03 Music Genre classification Scripts、ACCESS的参数化查询,附VBSCRIPT(ASP)和C#(ASP.NET)函数、ACCESS的参数化查询,附VBSCRIPT(ASP)和C#(ASP.NET)函数第1/2页、asp(vbscript)中自定义函数的默认参数实现代码的有用信息。
本文目录一览:- asp-classic – 带参数的vbscript:getref(vbs function参数)
- 2011-08-03 Music Genre classification Scripts
- ACCESS的参数化查询,附VBSCRIPT(ASP)和C#(ASP.NET)函数
- ACCESS的参数化查询,附VBSCRIPT(ASP)和C#(ASP.NET)函数第1/2页
- asp(vbscript)中自定义函数的默认参数实现代码
asp-classic – 带参数的vbscript:getref(vbs function参数)
下面的代码只是一个例子,dons’t不工作,如何将参数传递给mySub子?
<button id="myBtn">Click me</button> <script type="text/vbscript"> document.getElementById("myBtn").onclick=GetRef("mySub") Sub mySub(parameter) alert(parameter) End Sub </script>
解决方法
The code provided in the onclick attribute will be called when the
user clicks on the text enclosed in the span. This mechanism is great
for small snippets of code,but it becomes cumbersome when you have a
lot of script. This event mechanism works with both VBScript and
JScript.What happens behind the scenes is that Internet Explorer calls into
the script engine with the script code and tells the engine to create
an anonymous function (a function with no name). Those of you who kNow
VBScript are probably wondering how it does this,since VBScript
doesn’t support anonymous functions. VBScript actually creates a
subroutine called “anonymous” containing the script and returns a
pointer to the function that is then hooked up to the event.
然后试试这个.hta:
<html> <!-- !! https://stackoverflow.com/questions/10741292/vbscript-getref-with-parameter --> <head> <title>GetRef HTA</title> <HTA:APPLICATION APPLICATIONNAME="GetRef HTA" > <SCRIPT Language="VBScript"> Sub SetClickHandlers() Set bttB.onClick = GetRef("noparmsBttB") Set bttE.onClick = GetRef("Magic") Set bttF.onClick = GetRef("Magic") End Sub ' trivial handler,literally set Sub noparmsBttA() Log "noparmsBttA() called." End Sub ' trivial handler,set via GetRef Sub noparmsBttB() Log "noparmsBttB() called." End Sub ' one handler for many buttons,literally set Sub handleClickCD(oBtt) Log "handleClickCD() called; you clicked " & oBtt.id End Sub ' one handler for many buttons,set via Magic() & GetRef Sub handleClickEF(oBtt,dtWhen) Log "handleClickEF() called; you clicked " & oBtt.id & " at " & CStr(dtWhen) End Sub ' stuffed via GetRef into onClick Sub Magic() handleClickEF Me,Now End Sub Sub Log(s) MsgBox s,Now End Sub </SCRIPT> </head> <body onLoad="SetClickHandlers"> <!-- literal onClick handler in html code --> <button id="bttA" onClick="noparmsBttA">A</button> <!-- no literal onClick handler,will be set by SetClickHandlers via GetRef() --> <button id="bttB">B</button> <!-- literal onClick handlers with parameter (Me,i.e. the Button) --> <button id="bttC" onClick="handleClickCD Me">C</button> <button id="bttD" onClick="handleClickCD Me">D</button> <!-- Two params handler via SetClickHandlers & Magic --> <button id="bttE">E</button> <button id="bttF">F</button> </body> </html>
查看
>那个/如何指定没有参数的Sub来按字面意思或通过GetRef处理点击(A或B)
>你可以使用一个参数化的Sub来处理许多按钮的点击,因为引擎将文字代码放入一个匿名的Sub(没有参数)(C / D)
>你不能使用GetRef(“SubWithLotsOfParms”)来设置onClick属性 – 它需要没有参数的s Sub
>你可以让一个没有参数的命名Sub(例如Magic)做引擎匿名的工作;这个Sub然后可以与GetRef一起使用
WRT Salman A的回答:
如果您确实需要一条错误消息,例如:
--------------------------- Error --------------------------- A Runtime Error has occurred. Do you wish to Debug? Line: 54 Error: Wrong number of arguments or invalid property assignment: 'mySub' --------------------------- Yes No ---------------------------
然后你只需要添加:
Sub mySub(parameter) alert(parameter.toString()) End Sub
和
<!-- literal onClick handler in html code --> <button id="bttG" onClick="mySub">G</button>
测试.hta.
WRT彼得的建议 – 保持简单是值得的:
Option Explicit Sub WithLotsOfParms(a,b,c,d) WScript.Echo Join(Array(a,d)) End Sub Dim f : Set f = GetRef("WithLotsOfParms") WithLotsOfParms 1,2,3,4 f 1,4
输出:
cscript 01.vbs 1 2 3 4 1 2 3 4
您使用GetRef()设置的变量名称与您使用文字子/函数名称完全一样,可能已在昨天建立.
2011-08-03 Music Genre classification Scripts
scripts:
(1) Batch extract all the feature sets using OpenSmile:
perl stddirectory_smileextract.pl /home/sudan/Desktop/research/MusicGenreClassification/genres_16k_mono_wav/ emobase.conf out.arff
(2) Using bextract to do the prediction (with all the feature sets in bextract)
bextract -sv -timbral -spfe -chroma -sfm -scf -lsp -lpcc genrES10.mf -tc testdata_2.mf -w temp.arff
(3)Using bextract to do the prediction (with only the timbral feature sets in bextract)(3)
bextract -sv -timbral genrES10.mf -tc testdata_2.mf -w temp.arff
Even though the recognition results seems better for (3) over (2),it is still not make so much sense at all.
(4) add a plain line betweent the test mf file awk '{print $1 "\n"}' testdata_2.mf >testdata_2_double.mf
(5) USing weka's SMO to do the prediction:
java -xms1024m weka.classifiers.functions.SMO -t /home/sudan/Desktop/research/MusicGenreClassification/features_all_temp.arff -c last -T /home/sudan/Desktop/research/MusicGenreClassification/testdata_3.arff -p 0 -o > pred.out
ACCESS的参数化查询,附VBSCRIPT(ASP)和C#(ASP.NET)函数
最近因项目需要用ACCESS做数据库开发WEB项目看论坛上还许多人问及ACCESS被注入的安全问题
许多人解决的方法仍然是用Replace替换特殊字符,然而这样做也并没有起到太大做用
今天我就把我用ACCESS参数化查询的一些方法和经验和大家分享
希望对大家有所启发,有写的不对的地方希望高手们多多指教
ASP.NET 用OleDbCommand的new OleDbParameter创建参数货查询
ASP用Command的CreateParameter 方法创建参数化查询
(sql储存过程查询也是用这个方法建立的)
ASP.NET C#语法
----------------------------------------------------------------------------
OleDbParameter parm = new OleDbParameter(Name, Type, Direction, Size, Value);
(实际上它有七重载大家具体大家可以在VS.net里面就可以看到)
参数
Name 可选,字符串,代表 Parameter 对象名称。
Type 可选,长整型值,指定 Parameter 对象数据类型。
Direction 可选,长整型值,指定 Parameter 对象类型。。
Size 可选,长整型值,指定参数值最大长度(以字符或字节数为单位)。
Value 可选,变体型,指定 Parameter 对象的值。
以下是实例,查询news表中所有tsing发表的新闻
-------------------------------------------------------
sql="select * from newss where username=? order by id"
//注意查询的条件均用?号表示
OleDbConnection conn = new OleDbConnection(connString);
OleDbCommand cmd = new OleDbCommand(sql,conn);
OleDbParameter parm = new OleDbParameter("temp",OleDbType.VarChar, 50);
//temp为Parameter对象可随便定义,OleDbType.VarChar指定为字符串,长度50
parm.Direction = ParameterDirection.Input;
//指定其类型输入参数
cmd.Parameters.Add(parm);
cmd.Parameters["temp"].Value = "tsing";
//查询tsing,也可以写成cmd.Parameters[0]
conn.open();
cmd.ExecuteReader();
----------------------------------------------------------------------------
ASP VBSCRIPT语法
----------------------------------------------------------------------------
Set parameter = command.CreateParameter (Name, Value)
参数同上
以下是实例,查询news表中所有tsing发表的新闻
------------------------------------------------------
et conn = Server.CreateObject("Adodb.Connection")
conn.ConnectionString = connString
conn.open()
set mycmd = Server.CreateObject("ADODB.Command")
mycmd.ActiveConnection=conn
mycmd.CommandText=sql
mycmd.Prepared = true
set mypar = mycmd.CreateParameter("temp",129,1,50,"tsing")
mycmd.Parameters.Append mypar
set myrs = mycmd.Execute