Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: option value


Message #1 by "tan" <yytan@e...> on Tue, 10 Sep 2002 10:48:58
Dear Sten;

wow, i am glad and shock to receive your answer. it is working and thanks a
lot.
wish you all the best.

----- Original Message -----
From: "Sten Hougaard" <STG@e...>
To: "JavaScript HowTo" <javascript_howto@p...>
Sent: Tuesday, September 10, 2002 7:26 PM
Subject: [javascript_howto] Re: option value


>
> Hi,
>
> Try this :-)
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 divansitional//EN">
> <html>
> <head>
> <title></title>
> <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
> <meta name="vs_targetSchema" content
> ="http://schemas.microsoft.com/intellisense/ie5">
> <script language="javascript">
>
> var aAll            = new Array();
> var aBook           = new Array('publisher', 'year', 'title');
> var aMagazine  = new Array('author', 'isbn', 'title');
> var aLinks          = new Array('book', aBook, 'magazine', aMagazine);
>
> function showSearch(oElement) {
>      for(var i=0; i<aLinks.length-1; i+=2) {
>           if (oElement.id==aLinks[i]) {
>                showRows(aLinks[i+1]);
>           }
>      }
> }
>
> function showRows(aShow) {
>      for(var i=0; i<aAll.length; i++) {
>           aAll[i].style.display    = 'none';
>           for(var ii=0; ii<aShow.length; ii++) {
>                if (aShow[ii]==aAll[i].id) {
>                     aAll[i].style.display     = 'block';
>                }
>           }
>      }
> }
>
> function getSearchRows(){
>      var oTemp = document.getElementsByTagName('div');
>      for(var i=0; i<oTemp.length; i++) {
>           if (oTemp[i].className=='search') {
>                aAll[aAll.length]   = oTemp[i];
>           }
>      }
> }
>
> </script>
> <style type="text/css">
> div { font-size: 9pt; font-family: arial}
> inputfield { border: 1px solid gray; width: 70px; border-top: 1px solid
> black; border-left: 1px solid black; background-color: #e0e0e0; color:
> black}
> selection {border: 1px solid blue; width: 200px}
> search { display: none; width: 150px}
> selectlabel {width: 100px;}
> fieldlabel {width: 60px; position: relative; left: 5px; top: 3px; float:
> left}
> #searchvalues {border: 1px solid blue; width: 200px; border-top: 0px solid
> blue;}
> </style>
> </head>
> <body onload="getSearchRows();">
> <div class="selection">
>      <span><input onclick="showSearch(this)" type="radio" name="searchFor"
> value="book" id="book"><label class="selectlabel">Book:</label></span>
>      <span><input onclick="showSearch(this)" type="radio" name="searchFor"
> value="magazine" id="magazine"><label class="selectlabel">Magazine:</label
> ></span>
> </div>
> <div id="searchvalues">
>      <div id="publisher" class="search">
>           <span class="fieldlabel">Publisher:</span><input type="text"
name
> ="publisher" id="publishervalue" class="inputfield">
>      </div>
>      <div id="year" class="search">
>           <span class="fieldlabel">Year:</span><input type="text" name
> ="year" id="yearvalue" class="inputfield">
>      </div>
>      <div id="author" class="search">
>           <span class="fieldlabel">Author:</span><input type="text" name
> ="author" id="authorvalue" class="inputfield">
>      </div>
>      <div id="title" class="search">
>           <span class="fieldlabel">Title:</span><input type="text" name
> ="title" id="titlevalue" class="inputfield">
>      </div>
>      <div id="isbn" class="search">
>           <span class="fieldlabel">Isbn:</span><input type="text" name
> ="isbn" id="isbnvalue" class="inputfield">
>      </div>
> </div>
> </body>
> </html>
>
> Cheers
>
> Sten Hougaard
> EDB Gruppen, Denmark
>
>
>
>
>                     "tan"
>                     <yytan@e...       To:     "JavaScript HowTo"
<javascript_howto@p...>
>                     .my>                 cc:
>                                          Subject:     [javascript_howto]
option value
>                     10-09-2002
>                     12:48
>                     Please respond
>                     to "JavaScript
>                     HowTo"
>
>
>
>
>
>
> hi there;
>
> i am doing a search engine, so below is my search outlook
>
> 1 option menu: book / magazine (book value is selected)
>
>                     text to search   2 option menu according book/magazine
>
> or/and menu         text to search   2 option menu according book/magazine
>
> or/and menu         text to search   2 option menu according book/magazine
>
>
> first at all, if the user selected "magazine", in the 2 option menu
> (apply all), the value are "publisher" , "year" , "title"
>
>               if the user selected "book", in the 2 option menu (apply
> all), the value are   "author" , "isbn" , "title".
>
> may i know how to do that? thanks in advance.
>
>
>
> Best Regards;
> Yoke Yew
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
>
>
>
>
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
>
>



  Return to Index