🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.javascript
Article #49

Re: Please tell my why this won't work.

#49
From: Peng A. Khor
Date: Sat, 10 Aug 1996 00:00
47 lines
2549 bytes
---------------------------------------------------------------------------

Just a followup and a solution to the problem.

You cannot use text1.value for the select parameter.
You must make use of the index of the options.

The following modified html works.

 <html>
 <head>
 <script language="JavaScript">
 <!-- Hide
 
 function test1(form) 
{
 
  index=form.text1.selectedIndex;  
  if (form.text1.options[index].text == "")
    {alert("Please enter a string!");}
  else if (form.text1.options[index].text == "INCOR")
   { parent.location.href="http://www.prostar.com/web/alpine/incor/";}
  else if (form.text1.options[index].text == "ALPine")
   {
parent.location.href="http://www.prostar.com/web/alpine/welcome.htm";}
 }
 // -->
 </script>
 </head>
 <body>
 <form name="first" method="post">
 THE ORGANIZATION YOU WANT TO GOTO IS<br>
 <select name="text1">
 <option selected value="ALPine">ALPine
 <option value="INCOR">INCOR
 </select>
 <input type="button" name="button1" value="GOTO"
 onClick="test1(this.form)">
 <P>
 </form>
 </body>
 </html>

 Have more fun in your web authoring !

Peng Khor
Technical Details
Message-ID: <4uh2qg$7eo@news.istar.ca>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <4u7o8p$9j5@amber.ora.com> <320A3B5D.62DF@mail.prostar.com> <320B6065.71D6@hydro.on.ca>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f7cbd,a6f41a01eab140ed
X-Google-Attributes: gidf7cbd,public
X-Google-Thread: fb3cb,a6f41a01eab140ed
X-Google-Attributes: gidfb3cb,public
X-Google-Thread: f5d71,a6f41a01eab140ed
X-Google-Attributes: gidf5d71,public
X-Google-Thread: 10d861,a6f41a01eab140ed
X-Google-Attributes: gid10d861,public
X-Google-Thread: 10aaab,a6f41a01eab140ed
X-Google-Attributes: gid10aaab,public
X-Google-Thread: fd796,a6f41a01eab140ed
X-Google-Attributes: gidfd796,public
X-Google-Thread: 143f9e,a6f41a01eab140ed
X-Google-Attributes: gid143f9e,public
X-Google-Thread: 109f69,a6f41a01eab140ed
X-Google-Attributes: gid109f69,public
From: "Peng A. Khor" <pkhor@istar.ca>
Subject: Re: Please tell my why this won't work.
Date: 1996/08/10
Message-ID: <4uh2qg$7eo@news.istar.ca>
X-Deja-AN: 173271612
references: <4u7o8p$9j5@amber.ora.com> <320A3B5D.62DF@mail.prostar.com> <320B6065.71D6@hydro.on.ca>
content-type: text/plain; charset=us-ascii
organization: .
mime-version: 1.0
reply-to: peng.khor@hydro.on.ca
newsgroups: comp.lang.javascript,comp.lang.java.programmer.announce,comp.lang.java,alt.www.hotjava,biz.books.technical,misc.books.technical,alt.books.technical,comp.infosystems.www.authoring.cgi,comp.infosystems.www.authoring.html,comp.infosystems.www.authoring.misc,comp.infosystems.www.misc
x-mailer: Mozilla 3.0b7 (Win16; I)