Simple Drop down with data

jackroger

Banned
Jul 15, 2010
10
0
0
Hi,,,




I have a website which is made using ASP
On one of the page I am required to show a lot of data....

The idea is to have a drop down menu with options like Product 1, Product 2 ... Product 20

Once the user selects say Product 1 some data should be displayed below the drop down menu... without reloading the page.. .

Can this be done... and where can i find some codes for it...

thanks
 


You can easily achieve this using the switch function of JS - I am posting a sample code below - let me know i this is what you're looking for.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Pulse Content JS Example</title>
<script language="javascript">

function DrawForm( )
{
    var FormArea = document.getElementById( 'FormArea' ) ;
   
    switch( document.theForm.ActionSelect.selectedIndex )
    {
        case 1 :
                FormArea.innerHTML =    'Description 1'   
        break;
       
        case 2 :
            
        FormArea.innerHTML =    'Description 2';
        break;
       
        case 3 :
            
        FormArea.innerHTML =    'Description 3'
        break;
       
        default :
            FormArea.innerHTML = '';
    }
}
</script>
</head>

<body>
<div id="theMessage"></div>
<form action="" method="post" name="theForm">
    <select name="ActionSelect" onchange="DrawForm()">
        <option value="-1">Please choose an option</option>
        <option value="1">Option 1</option>
        <option value="2">Option 2</option>
        <option value="3">Option 3</option>
    </select>
<div id="FormArea"></div>  
</form>
</body>
</html>
 
if you wanna change the details appearing as per the selected value, you should re-load the page i guess. because, you need to submit the value and it has to get back the respective details right?

Thank you for bumping a month old thread - I just wasted 10 minutes of my life writing code for a Banned user.

So yeh... Fuck you.