CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 Accessing the Options Array inside the select tag

Print topic Send  topic

Author Message
tambam7861

Posts: 3
Posted: 10/24/2008, 10:35 AM

Hello All,

I have the drop down menu below. I would like to know how I can gain access to the options array and then write out the value of the selected index. I have been trying, code like document.write(LastName.options[index]), which you can find at the very top of the code.I just can not get it to work. Please help!

Code Below:
-------------------------------------------------------
<script>
var z = document.LastName.options[1];
document.write(z)
</script>

<body>
<table border="0" width="80" cellspacing="0">
<tr><td width="100%" bgcolor="#000000">

<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr><td width="100%" background="images/boxtopLast.png"><img border="0" src="images/11dot.gif" width="19" height="19"></td></tr>
</table>

<table border="0" width="100%" cellspacing="0" cellpadding="3">
<tr><td width="2%" background="images/boxbackA.png">

<img border="0" src="images/11dot.gif" width="18" height="18">
</td><td width="98%" background="images/boxbackB.png"><select name="LastName" class="combobox" id="LastName" onChange="LastName()">
<option selected>Last Name </option>
<option value="4">Abboud</option>
<option value="31">Aberasturi</option>
<option value="108">Agudela</option>
<option value="125">Akhtar</option>
<option value="101">Alkins</option>
<option value="33">Aly</option>
<option value="92">Arrigo</option>
<option value="76">Astrella</option>
<option value="58">Avci</option>
<option value="146">Bakarich</option>
<option value="95">Balseca</option>
<option value="66">Bass</option>
<option value="113">Bast</option>
<option value="28">Beach</option>
<option value="130">Bendersky</option>
<option value="39">Bi</option>
<option value="145">Bola</option>
<option value="26">Borrero</option>
<option value="116">Boyde</option>
<option value="8">Brzozowski</option>
<option value="117">Bustios</option>
<option value="141">Cadag</option>
<option value="104">Cahill</option>
<option value="159">Camo</option>
<option value="9">Castro</option>
<option value="1">Chan</option>
<option value="99">Check</option>
<option value="102">Cheng</option>
<option value="46">Cipolla</option>
<option value="139">Clark</option>
<option value="55">Coco</option>
<option value="37">Cortese</option>
<option value="119">Cosmanscu</option>
<option value="59">Cussen</option>
<option value="42">Cyrus</option>
<option value="21">Daddazio</option>
<option value="11">Dawson</option>
<option value="150">DiBernardo</option>
<option value="84">Dickson</option>
<option value="7">Dimaggio</option>
<option value="63">Dodhia</option>
<option value="126">Donato</option>
<option value="52">Dubow</option>
<option value="51">Eldridge</option>
<option value="29">Esterman</option>
<option value="2">Ettouney</option>
<option value="114">Evans</option>
<option value="135">Fanjiang</option>
<option value="15">Fayad</option>
<option value="151">Ferreira</option>
<option value="155">Forero</option>
<option value="18">Franzen</option>
<option value="43">Freeman</option>
<option value="110">Gajer</option>
<option value="53">Galvin</option>
<option value="82">Georgakopoulos</option>
<option value="118">Goddard</option>
<option value="71">Gokhale</option>
<option value="32">Goodwin</option>
<option value="83">Gordon</option>
<option value="106">Grillo</option>
<option value="38">Gu</option>
<option value="147">Habib</option>
<option value="47">Hapij</option>
<option value="94">Harris</option>
<option value="77">Heinze (Angela)</option>
<option value="81">Heinze (Doug)</option>
<option value="144">Herrera</option>
<option value="5">Highfill</option>
<option value="105">Hu</option>
<option value="74">Hunter</option>
<option value="128">Hurtado</option>
<option value="143">Ilardi</option>
<option value="10">Jebejian</option>
<option value="111">Jeng</option>
<option value="16">Jing</option>
<option value="103">Jiratatprasot</option>
<option value="154">Jonas</option>
<option value="124">Jurado</option>
<option value="57">Kelly</option>
<option value="22">Kirk</option>
<option value="13">Kmetz</option>
<option value="133">Koalyshyn</option>
<option value="80">Koklanos</option>
<option value="41">Kovac</option>
<option value="109">Lambert</option>
<option value="60">Lapointe</option>
<option value="67">Lau</option>
<option value="6">Lee</option>
<option value="23">Lei</option>
<option value="72">Lewis</option>
<option value="45">Lingareddy</option>
<option value="86">Loizi</option>
<option value="107">Lopez</option>
<option value="56">Matthews</option>
<option value="134">Mauch</option>
<option value="157">Mayrbaurk</option>
<option value="136">Miranda</option>
<option value="121">Mousa</option>
<option value="138">Mozina</option>
<option value="93">Neuberger</option>
<option value="12">Nguyen</option>
<option value="96">Ochman</option>
<option value="24">Osae</option>
<option value="100">Ouzoonian</option>
<option value="44">Panchyk</option>
<option value="89">Pappas</option>
<option value="34">Paskus</option>
<option value="14">Pedroni</option>
<option value="75">Pekoz</option>
<option value="20">Pelekanos</option>
<option value="91">Pfiko</option>
<option value="153">Ponsades</option>
<option value="137">Pontillo</option>
<option value="149">Quinn</option>
<option value="49">Ranlet</option>
<option value="17">Rittenhouse</option>
<option value="127">Robert</option>
<option value="35">Rodriguez (Mike)</option>
<option value="87">Rodriguez (Patricia)</option>
<option value="68">Rona</option>
<option value="90">Rubin</option>
<option value="69">Rutner</option>
<option value="3">Sandler</option>
<option value="152">SanJuan</option>
<option value="98">Sheth</option>
<option value="73">Singh</option>
<option value="123">Sinke</option>
<option value="88">Smilowitz</option>
<option value="115">St. John</option>
<option value="30">Stanley</option>
<option value="65">Stock</option>
<option value="142">Summerville</option>
<option value="70">Tang</option>
<option value="132">Tawiah</option>
<option value="85">Taylor</option>
<option value="36">Terry</option>
<option value="27">Timothy</option>
<option value="131">Turner</option>
<option value="25">Udvardy</option>
<option value="112">Vance</option>
<option value="50">Vasquez</option>
<option value="78">Velazquez</option>
<option value="158">Velez</option>
<option value="160">Viera</option>
<option value="40">Vollenweider</option>
<option value="120">Wang (Ken)</option>
<option value="61">Wang (King)</option>
<option value="54">Wielinski</option>
<option value="156">Wiprud</option>
<option value="48">Woelke</option>
<option value="19">Wojcik</option>
<option value="79">Wolff</option>
<option value="0">Wright</option>
<option value="64">Xu</option>
<option value="97">Ye</option>
<option value="129">Zander</option>
<option value="62">Zeng</option>
<option value="140">Zhang (Fangyin)</option>
<option value="122">Zhang (Jeremy)</option>
<option value="148">Zhang (Wuzhen)</option>

</select>

</td></tr>
</table>
</td></tr>
</table></body>

<style type="text/css">
<!--
.combobox {
background-color: #FFFFFF;
color: #808080;
font-size: 10pt;
font-family: times;
}
--></style>
View profile  Send private message
melvyn


Posts: 333
Posted: 10/24/2008, 8:16 PM

I've seen your code and you have the trick: onChange="LastName()">

Change it for: onChange="LastName(this.value)">

As you use the LastName() function, I guess you have that funcion defined in your javascript.

  
<script type="text/javascript">  
function LastName(xxx){  
   alert(xxx);  
}  
</script>  

By the way, this is not a codecharge's issue, neither a tip or solution.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.