Recomendado: Funciones comunes para ASP: str4js () Código del programa % 'Función: Definición para convertir a la salida de cadena de JavaScript (convención en JavaScript, Cotizaciones en cotizaciones en cotizaciones individuales)' Fuente: http://www.cncms.com/asp.asp function str4js (sstring) str4js = sstring if isnull (sstring) luego str4js =: exit str4js
Código de programa
<%
'Función: se usa para verificar qué valores de la casilla de verificación especificada
'Fuente: http://www.cncms.com/asp.asp
Function checkBoxScript (byval formelement, byval elementValue)
CheckboxScript = <scr & iPT lenguaje = javascript type = text/javascript> & vbcrlf & string.prototype.
CheckboxScript = checkboxScript & realmentedo = function () {return this.replace (/(^/s*) | (/s*$)/g,);} & vbcrlf
CheckBoxScript = checkboxScript & var jorkin = & elementValue & .split (,); & vbcrlf
CheckboxScript = checkboxScript & for (i = 0; i <& formelement & .length; i ++) {& vbcrlf
CheckboxScript = checkboxScript & for (j = 0; j <jorkin.length; j ++) {& vbcrlf
CheckboxScript = checkboxScript & if (jorkin [j] .reallydo () == & formelement & [i] .value.realydo ()) {& vbcrlf
CheckBoxScript = checkBoxScript & & Formelement & [i] .ecked = true}}} </scr & ipt> & vbcrlf
Función final
%>
ejemplo:
Código de programa
<form de nombre = form1>
<input name = realmentedo type = checkbox id = realmentedo1 valor = 10 /> 10
<input name = realmentedo type = checkbox id = realmentedo2 valor = 20 /> 20
<input name = realmentedo type = checkbox id = realmentedo3 valor = 30 /> 30
<input name = realmentedo type = checkbox id = realmentedo4 valor = 40 /> 40
<input name = realmentedo type = checkbox id = realmentedo5 valor = 50 /> 50
</form>
<%= CheckboxScript (form1.reallydo, 10,30,50)%>
Compartir: Funciones comunes de ASP: WriteLn () println () Código del programa % 'Función: String String Plus Break' Fuente ': http://www.cncms.com/asp.asp Función WRITELN (SSTRING) Response.Write (SSTRING VBCRLF) Función final % Código del programa %' Función: String de salida más HTML Código BR/'Fuente: http://wwww.cncms.com/asp.