Red de conocimiento informático - Material del sitio web - Cómo llamar funciones en javascript en jsp

Cómo llamar funciones en javascript en jsp

lt;@ página language="java" import="java.util.*" pageEncoding="utf-8"gt;

lt;

Ruta de cadena = request.getContextPath();

Cadena basePath = request.getScheme() "://" request.getServerName() ":" ruta de request.getServerPort() "/";

gt;

lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transicional//ES"gt;

lt;htmlgt;

lt;headgt;

lt;base href="lt;=basePathgt;"gt;

lt;titlegt;Mi página de inicio de JSP 'checkBox.jsp'lt; /titlegt;

lt;script type="text/javascript"gt;

función JoinDemo(){

alerta("sss"); p>

var aa = document.getElementsByName("checkname");

var bb = document.getElementById("bname"); == "Seleccionar todo"){

for( var i = 0; ilt; aa.length; i ){

aa[i].checked="true";

}

bb.value="Cancelar"

}

else{

for(var i= 0; ilt; aa.length; i ){

aa[i].checked = false

}; /p >

}

}

lt;/scriptgt;

lt;/headgt;

lt;bodygt;

p>

lt; tipo de entrada="casilla de verificación" nombre="nombre de verificación" valor="Baloncesto" gt; tipo de entrada="casilla de verificación" nombre="nombre de verificación" valor="Fútbol "gt; fútbol

lt; tipo de entrada="casilla de verificación" nombre="nombre de verificación" valor="En línea"gt; Valor "nombre="nombredecomprobacion"

="Leer un libro"gt;Leer un libro

lt; input type="button" name="bname" value="Seleccionar todo" onclick="JoinDemo()"gt;

lt ;/bodygt;

lt;/htmlgt;