Hi
I am using php and smarty, what i have to do is i have a drop down box with dynamic name, id and values.
like
I want to take one value form that and i have to show in alert box, i tried some method but no use.
Ex :
Javascript code on top of the html page:
But this showing all the values in the drop down box. i want to take only one value from the drop down..
can anyone help me what will be the correction in this please.
regards
magesh
I am using php and smarty, what i have to do is i have a drop down box with dynamic name, id and values.
like
Code:
<select name="id[{$options_data.ID}]" id="id[{$options_data.ID}]" onchange="sample()" >
{foreach key=key_data item=item_data from=$options_data.DATA}
<option value="{$item_data.ID}">{$item_data.TEXT} {if $item_data.PRICE !='' }{$item_data.PREFIX} {$item_data.PRICE}{/if} </option>
{/foreach}
</select>
Ex :
Code:
<select name ="id[{$options_data.ID}]" id="id[{$options_data.ID}]" onchange="sample()>
<option value="45">value 1</option>
<option value ="46">value 2</option>
</select>
Javascript code on top of the html page:
Code:
<script language="javascript">
function sample()
{
var id = document.getElementById("id[3]");
alert("The content of the first " + "\"" + id.innerHTML + "\".");
}
</script>
can anyone help me what will be the correction in this please.
regards
magesh
Comment