Article View: chile.comp.programacion
Article #1816Re: OnChange VBScript v/s JavaScript
From: gato2005_cl
Date: Tue, 23 May 2006 04:29
Date: Tue, 23 May 2006 04:29
117 lines
4220 bytes
4220 bytes
Este codigo te muestra el textbox o si no eligues adj te redirecciona a
yahoo.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Documento sin título</title>
</head>
<body>
<form name="form">
<select name="combo1" onChange="Mostrar()">
<option value="000" selected> </option>
<option value="ADJ">Adjudicada</option>
<option value="PER">Perdidas</option>
<option value="REC">Rechazada</option>
</select>
</form>
<script language="javascript">
function Mostrar()
{
if (document.form.combo1.value=='ADJ')
{
document.write("<p><input type='text' name='textfield'></p>");
}
else
{
document.write ("<p> </p>");
document.location.href="http://www.yahoo.com";
}
}
</script>
</body>
</html>
gato2005_cl escribi�:
> Para comenzar las comillas estan mal, se escriben asi " 'lo que sea' ",
> a que lugar retorna la cadena de la funcion?, el resultado es
> "Onchange='<p><input type='text' name='textfield'></p>'", lo cual no
> tiene el menor sentido.
>
> Si usaste response.write, usa document.write.
>
> Lakrom escribi�:
>> Se�ores tengo el siguiente codigo VBScript:
>>
>> <%
>> sub Carga()
>> if request("cod") = "ADJ" Then
>> response.Write("<p><input type='text' name='textfield'></p>")
>> else
>> response.Write("<p> </p>")
>> end if
>> End Sub
>> %>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>> "http://www.w3.org/TR/html4/loose.dtd">
>> <html>
>> <head>
>> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
>> <title>Untitled Document</title>
>> </head>
>> <body>
>> <p><form name="Form10" action="prb2.asp">
>> <select name="select" onChange="location.href('prb2.asp?cod='+
>> Form10.select.options[Form10.select.selectedIndex].value)">
>> <option value="000" selected> </option>
>> <option value="ADJ">Adjudicada</option>
>> <option value="PER">Perdida</option>
>> </select>
>> </form>
>> </p>
>> <%Carga()%>
>> </body>
>> </html>
>>
>> Funciona OK pero ahora o implemente solo con javascript y se me
>> desaparece el select.
>> Algun experto de JavaScript que sepa como se hace.
>>
>> este es el codigo en java que no funciona.
>>
>> <html>
>> <head>
>> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
>> <title>Documento sin título</title>
>> </head>
>>
>> <body>
>> <form name="form">
>> <select name="combo1" onChange="Mostrar()">
>> <option value="000" selected> </option>
>> <option value="ADJ">Adjudicada</option>
>> <option value="PER">Perdidas</option>
>> <option value="REC">Rechazada</option>
>> </select>
>> </form>
>> <script language="javascript">
>> function Mostrar()
>> {
>> if (document.form.combo1.value=='ADJ')
>> {
>> return('<p><input type='text' name='textfield'></p>');
>> }
>> else
>> {
>> return('<p> </p>');
>> }
>> }
>> </script>
>> </body>
>> </html>
>>
>>
Technical Details
Message-ID:
<e4u335$ss0$1@news.nivel5.cl>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!meganewsservers.com!feeder2.on.meganewsservers.com!nntp-server.pubsub.com!news.nivel5.cl!not-for-mailReferences:
<e4tl57$2ik$1@proxy.ifxnw.cl> <e4u2d6$so5$1@news.nivel5.cl>Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,6e835526db0d50a7 X-Google-Attributes: gid1593cb,public X-Google-Language: SPANISH,CP1252 Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!meganewsservers.com!feeder2.on.meganewsservers.com!nntp-server.pubsub.com!news.nivel5.cl!not-for-mail From: gato2005_cl <misforos.chileSINESTO@gmail.com> Newsgroups: chile.comp.programacion Subject: Re: OnChange VBScript v/s JavaScript Date: Tue, 23 May 2006 00:29:08 -0400 Organization: Varios Lines: 117 Message-ID: <e4u335$ss0$1@news.nivel5.cl> References: <e4tl57$2ik$1@proxy.ifxnw.cl> <e4u2d6$so5$1@news.nivel5.cl> NNTP-Posting-Host: pc-178-51-86-200.cm.vtr.net Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.nivel5.cl 1148358566 29568 200.86.51.178 (23 May 2006 04:29:26 GMT) X-Complaints-To: news@news.nivel5.cl NNTP-Posting-Date: Tue, 23 May 2006 04:29:26 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows; U; Win98; es-ES; rv:1.7.10) Gecko/20060419 Thunderbird/1.5.0.2 Mnenhy/0.7.4.0 In-Reply-To: <e4u2d6$so5$1@news.nivel5.cl>