🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #1818

Re: OnChange VBScript v/s JavaScript

#1818
From: Lakrom
Date: Tue, 23 May 2006 06:24
124 lines
4562 bytes
Entiendo de hecho el codigo javascript desaparece el combo1, por lo menos 
eso llegue alcanzar, la idea es que trabaje igual que vbscript.

Gracias.

"gato2005_cl" <misforos.chileSINESTO@gmail.com> escribi� en el mensaje 
news:e4u335$ss0$1@news.nivel5.cl...
> 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&iacute;tulo</title>
> </head>
>
> <body>
> <form name="form">
> <select name="combo1" onChange="Mostrar()">
>   <option value="000" selected>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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&iacute;tulo</title>
>>> </head>
>>>
>>> <body>
>>> <form name="form">
>>> <select name="combo1" onChange="Mostrar()">
>>>   <option value="000" selected>&nbsp;</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>&nbsp;</p>');
>>>  }
>>> }
>>> </script>
>>> </body>
>>> </html>
>>>
>>> 
Technical Details
Message-ID: <e4u9ko$7em$1@proxy.ifxnw.cl>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!meganewsservers.com!feeder2.on.meganewsservers.com!nntp-server.pubsub.com!news.nivel5.cl!news2.ifxnw.cl!not-for-mail
References: <e4tl57$2ik$1@proxy.ifxnw.cl> <e4u2d6$so5$1@news.nivel5.cl> <e4u335$ss0$1@news.nivel5.cl>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,6e835526db0d50a7
X-Google-Attributes: gid1593cb,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!meganewsservers.com!feeder2.on.meganewsservers.com!nntp-server.pubsub.com!news.nivel5.cl!news2.ifxnw.cl!not-for-mail
From: "Lakrom" <lakrom@terra.cl>
Newsgroups: chile.comp.programacion
Subject: Re: OnChange VBScript v/s JavaScript
Date: Tue, 23 May 2006 02:24:56 -0400
Organization: IFX Networks News Server
Lines: 126
Message-ID: <e4u9ko$7em$1@proxy.ifxnw.cl>
References: <e4tl57$2ik$1@proxy.ifxnw.cl> <e4u2d6$so5$1@news.nivel5.cl> <e4u335$ss0$1@news.nivel5.cl>
NNTP-Posting-Host: 200.73.77.94
X-Trace: proxy.ifxnw.cl 1148365272 7638 200.73.77.94 (23 May 2006 06:21:12 GMT)
X-Complaints-To: abuse@ifxnetworks.com
NNTP-Posting-Date: Tue, 23 May 2006 06:21:12 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869