Empfohlen: Häufige Funktionen für ASP: STR4JS () Programmcode % 'Funktion: Definition zur Konvertierung in JavaScript String -Ausgabe (Konvention in JavaScript, Zitatzeichenfolgen in einzelnen Zitaten)' Quelle: http://www.cncms.com/asp.asp -Funktion Str4js (SSTRING) STR4JS = SSTRING IF ISNULL (SSTRING) dann Str4js =: Str4js =: Str4js =: Str4js =: Str4js =: Str4js =: Str4js =).
Programmcode
<%
'Funktion: Wird verwendet, um zu überprüfen, welche Werte des angegebenen Kontrollkästchens
'Quelle: http://www.cncms.com/asp.asp
Funktion CheckBoxScript (Byval Formelement, Byval ElementValue)
CheckBoxScript = <SCR & IPT Language = javaScript type = text/javaScript> & vbcrlf & string.Prototype.
CheckBoxScript = CheckBoxScript & realdo = function () {return this.replace (/(^/s*) | (/s*$)/g,);} & vbcrlf
CheckBoxScript = CheckBoxScript & var jorkin = & elementValue & .Split (,); & vbcrlf
CheckBoxScript = CheckBoxScript & für (i = 0; i <& .Length; i ++) {& vbcrlf
CheckBoxScript = CheckBoxScript & for (j = 0; j <Jorkin.Length; j ++) {& vbcrlf
CheckBoxScript = CheckBoxScript & if (Jorkin [j] .ReallyDo () == & FormElement & [i] .Value.ReallyDo ()) {& vbcrlf
CheckBoxScript = CheckBoxScript & & FormElement & [i]. Checked = true}}} </sc. & ipt> & vbcrlf
Endfunktion
%>
Beispiel:
Programmcode
<Formular name = Form1>
<Eingabename = Realydo Type = CheckBox ID = RealyDO1 Value = 10 /> 10
<Eingabename = Realydo Type = CheckBox ID = RealyDo2 Value = 20 /> 20
<Eingabename = Realydo Type = CheckBox ID = RealyDO3 Value = 30 /> 30
<Eingabename = Realydo Type = CheckBox ID = RealyDO4 Value = 40 /> 40
<Eingabename = Realydo Type = CheckBox ID = RealyDO5 Value = 50 /> 50
</form>
<%= CheckBoxScript (Form1.ReallyDo, 10,30,50)%>
Anteil: Häufige Funktionen von ASP: WriteLN () println () Programmcode % 'Funktion: Ausgabe String Plus Line Break' Quelle: http://www.cncms.com/sp. Function Writeln (SSTRING) Antwort.