By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,128 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

Need a help about drop down lists - Bit Urgent

P: 21
Hi
i am working on drop down list boxes.
My main aim is to display a table if the option is selected in the list box
i have kept the table as invisible
please guide me towards the solution
here goes the code




[HTML]<!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>
<script type="text/javascript">
function change()
{
if(document.forms[0].city.options.value=="vizag")
{
document.forms[0].list.style.display=true;
}
}
</script>
</head>

<body>
Films in City : <select name="city">
<option value="" selected>Select a city</option>
<option value="vizag" onClick="change()">Vizag</option>
</select>
<table id="list" style="display:none; ">
<tr>
<td height="87">Parugu</td>
<td>Jagadamba</td>
<td>Telugu</td>
</tr>
<tr>
<td height="95">Jaane Tu Ya Jaane Na</td>
<td>RamaDevi</td>
<td>Hindi</td>
</tr>
<tr>
<td height="163">Hancock</td>
<td>Sarada</td>
<td>English</td>
</tr>
</table>
</body>
</html>
[/HTML]


thanks in advance

kash
Jul 25 '08 #1
Share this Question
Share on Google+
3 Replies


RamananKalirajan
100+
P: 607
Hello Kash, Here is your working code

[HTML]<!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>
<script type="text/javascript">
function change()
{
var x = document.getElementById('mySelect').selectedIndex;
if(x==1)
document.getElementById('list').style.display = 'block';
}
function doThis()
{
document.getElementById('list').style.display = 'none';
}
</script>
</head>

<body onload="doThis()">
Films in City : <select name="city" id='mySelect' onChange="change()">
<option value="" selected>Select a city</option>
<option value="vizag">Vizag</option>
</select>

<table id="list" border="1" cellspacing="3" cellpadding="3">
<tr>
<td height="87">Parugu</td>
<td>Jagadamba</td>
<td>Telugu</td>
</tr>
<tr>
<td height="95">Jaane Tu Ya Jaane Na</td>
<td>RamaDevi</td>
<td>Hindi</td>
</tr>
<tr>
<td height="163">Hancock</td>
<td>Sarada</td>
<td>English</td>
</tr>
</table>
</body>
</html>[/HTML]

Enjoy

Regards
Ramanan Kalirajan
Jul 25 '08 #2

P: 21
Thank you very much ramanan

kash
Jul 26 '08 #3

RamananKalirajan
100+
P: 607
Thank you very much ramanan

kash
No Probs. If you need any help pls post it. I will help you out.

Regards
Ramanan Kalirajan
Jul 28 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.