Foros del Web » Programando para Internet » Javascript »

Vbscript no recoge valores del formulario

Estas en el tema de Vbscript no recoge valores del formulario en el foro de Javascript en Foros del Web. Hola, ¿ es posible desde vbscript extraer el valor del atributo name= de un formulario? un ejemplo: <form id="a"> <tr><td>Ejemplo</td><td ALIGN="CENTER"><INPUT type="checkbox" name="boton1"></td></tr> <tr><td>Ejemplo</td><td ALIGN="CENTER"><INPUT ...
 
Antiguo 12/06/2010, 06:37
 
Fecha de Ingreso: junio-2010
Mensajes: 24
Antigüedad: 16 años, 3 meses
Puntos: 0
Vbscript no recoge valores del formulario

Hola,

¿ es posible desde vbscript extraer el valor del atributo name= de un formulario? un ejemplo:

<form id="a">
<tr><td>Ejemplo</td><td ALIGN="CENTER"><INPUT type="checkbox" name="boton1"></td></tr>
<tr><td>Ejemplo</td><td ALIGN="CENTER"><INPUT type="checkbox" name="boton2"></td></tr>
</form>

yo quiero que cuando se pulse el boton de submit recoga el valor por medio de vbscript, es que no encuentro la manera de hacerlo he probado bastantes cosas.

gracias
 
Antiguo 12/06/2010, 06:54
Avatar de Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 19 años, 8 meses
Puntos: 126
Respuesta: Vbscript no recoge valores del formulario

Hola

¿Querrás decir javascript?
Podrías mostrar que tienes hecho hasta ahora

Suerte
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />
 
Antiguo 12/06/2010, 07:33
 
Fecha de Ingreso: junio-2010
Mensajes: 24
Antigüedad: 16 años, 3 meses
Puntos: 0
Respuesta: Vbscript no recoge valores del formulario

Si esto es lo que tengo:




<HTML>
<HEAD>


<TITLE>instalaciones</TITLE>
<HTA:APPLICATION
id="objHTAHelpomatic"
SINGLEINSTANCE="yes"
APPLICATIONNAME="Instalaciones">
SCROLL="yes"

</HTA:APPLICATION>



<style type="text/css">
body{
font-family: Arial, Tahoma;
font-size: 5px
}

caption {
color: #669933;
font-weight: bold;
text-decoration: underline;
text-transform: uppercase;
font-size: 5px;
}

th {
border: 0 solid;
height: 10px;
}

tr.resaltar {
background-color: #F5FFD7;
cursor: pointer;
}

tr.seleccionar {
background-color: #E8FF9F;
cursor: pointer;
}

</style>

<SCRIPT language="VBScript">


'*****************************************Begin of the script*********************************
Sub Window_OnLoad
Set WshShell = CreateObject("WScript.Shell")
window.resizeTo 465,720
Set objOption = Document.createElement("OPTION")
End Sub
'*****************************************End of the script**********************************
Sub window_onunload()
Set objFSO = Nothing
Set objFolder = Nothing
Set objTextFile = Nothing
Set WshShell = Nothing
End Sub

sub validar
Dim elFormulario
Set elFormulario = Document.forms("a")

end sub

Dim numero1, numero2
sub ejecutar
comprobar1
comprobar2
instalacion
end sub

sub comprobar1

If boton1.Checked Then
Set objShell0 = CreateObject("Wscript.Shell")
objShell0.run "cmd /c echo ""\\mad21cie04\Software\IT\software\Instalacio nes PC\Creative Suite Premium CS3\Adobe Cs3\Setup.exe"" >>c:\temp\instalacion.bat",0
Set objShell0 = Nothing
End If
end Sub

sub comprobar2

If boton2.Checked Then
Set objShell1 = CreateObject("Wscript.Shell")
objShell1.run "cmd /c echo opcion 2 activada >>c:\temp\instalacion.bat",0
Set objShell1 = Nothing
end If
end sub

sub comprobar3

If boton3.Checked Then
Set objShell2 = CreateObject("Wscript.Shell")
objShell2.run "cmd /c echo ""\\mad21cie04\Software\IT\software\Instalacio nes PC\cisco\cna-windows-k9-installer-5-4-en.exe"" >>c:\temp\instalacion.bat",0
Set objShell2 = Nothing
end If
end sub

Sub instalacion

Set objShell3 = CreateObject("Wscript.Shell")
objShell3.run "cmd /c c:\temp\instalacion.bat"
set objShell3 = Nothing

end sub


</SCRIPT>


<SCRIPT language="Javascript">



// grupo a

function checkvalidatea(checks) {
for (i = 0; chk = checks[i]; i++) {
if (chk.checked) {
return true;
}
}
return false;
}
function validacion() {
var grupo = document.getElementById("a").chk;
if (checkvalidatea(grupo)) {
ejecutar()
}}


function marcarTodo(){
for (i=0;i<document.formulario.elements.length;i++)
if(document.formulario.elements[i].type == "checkbox")
document.formulario.elements[i].checked=1 ;
}

function desmarcarTodo()
{
for (i=0;i<document.formulario.elements.length;i++)
if(document.formulario.elements[i].type == "checkbox")
document.formulario.elements[i].checked=0;
}






var varResalteCss = "resaltar";
var varSeleccionCss = "seleccionar";
agregarEvento(window,'load',comenzar,false);

function comenzar(){
resaltarFila();

seleccionaFila();
}


function seleccionaFila(id_tabla){

if (id_tabla == undefined){
var tabla = document.getElementsByTagName("table");
for(x = 0; x < tabla.length; x ++ ){
var checs = tabla[x].getElementsByTagName("input");
for(i = 0; i < checs.length; i ++ )
if (checs[i].type == "checkbox")
agregarEvento(checs[i], 'click', pintar_fila, false);
}

}else{

var table = document.getElementById(id_tabla);

var checs = table.getElementsByTagName("input");
for(i = 0; i < checs.length; i ++ )
if (checs[i].type == "checkbox")
agregarEvento(checs[i], 'click', pintar_fila, false);
}
}

function pintar_fila(e){

if (window.event)
var chec = window.event.srcElement;

else
if(e)
var chec = e.target;
fila = chec.parentNode;
while(fila.nodeName != "TR")
fila = fila.parentNode;
if (chec.checked)
fila.className = varSeleccionCss;
else
fila.className = null;
}


function agregarEvento(elemento, nombre_evento, funcion, captura){

if (elemento.attachEvent){
elemento.attachEvent('on' + nombre_evento, funcion);
return true;
}else
if (elemento.addEventListener){
elemento.addEventListener(nombre_evento,funcion,ca ptura);
return true;
}else
return false;
}

function resaltarFila(id_tabla){
if (id_tabla == undefined)
var filas = document.getElementsByTagName("tr");
else{
var tabla = document.getElementById(id_tabla);
var filas = tabla.getElementsByTagName("tr");
}
for(var i in filas) {
filas[i].onmouseover = function() {
if (this.className != varSeleccionCss)
this.className = varResalteCss;
}
filas[i].onmouseout = function() {
if (this.className != varSeleccionCss)
this.className = null;
}
}
}

function noResaltarFila(id_tabla){
if (id_tabla == undefined)
var filas = document.getElementsByTagName("tr");
else{
var tabla = document.getElementById(id_tabla);
var filas = tabla.getElementsByTagName("tr");
}
for(var i in filas) {
filas[i].onmouseover = function() {
this.className = null;
}
filas[i].onmouseout = function() {
this.className = null;
}
}
}

</script>


</HEAD>
<BODY bgcolor=#C7CFC1>

<table border="0" id="software" align="center" cellspacing="1">
<tr>
<th colspan="2" width="100%" align="center" bgcolor="#0A0A0A"><font color="#FFFFFF">SOFTWARE COMPLEMENTERARIO</th>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>

<form id="a">
<tr><td>Ejemplo</td><td ALIGN="CENTER"><INPUT type="checkbox" id="chk" name="boton1"></td></tr>
<tr><td>Ejemplo</td><td ALIGN="CENTER"><INPUT type="checkbox" id="chk" name="boton2"/></td></tr>

</form>


</table>
<P>
<table border="0" align="center">
<tr><td align="center"><INPUT align="center" type="button" value="INSTALAR" name= "d" onclick="validacion()"></td></tr>
</table>


</BODY>
</HTML>

Etiquetas: vbscript, formulario
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta



La zona horaria es GMT -6. Ahora son las 08:37.