Sponsered Links
Categories
Sponsered Links

JavaScript Drop Down Menu Example

 

This is a simple JavaScript Drop Down Menu Example.

index.php

<html>
    <head>
        <title>JavaScript Simple Drop Down Menu</title>
        <meta name="keywords" content="" />
        <meta name="description" content="" />
    </head>
    <script src="dropdown/drop.js" language="JavaScript" type="text/javascript"></script>
    <body>
        <form action="dropdown/drop.php" method="get">
            <select name="url" onchange="menu_goto(this.form)">
                <option value="java">java</option>
                <option value="jsp">jsp</option>
                <option value="servlet">servlet</option>
                <option value="jquery">jquery</option>
                <option value="ajax">ajax</option>
            </select>
            <input type="submit" value="Click!" />
        </form>
    </body>
</html>

 

drop.js

function menu_goto( menuform ){   
    var baseurl = 'dropdown/' ;
    selecteditem = menuform.url.selectedIndex ;
    newurl = menuform.url.options[ selecteditem ].value ;
    if (newurl.length != 0) {
        location.href = baseurl + newurl ;
    }
}

 

drop.php

<?php
    $baseurl = "dropdown/" ;
    $url  = $_REQUEST['url'] ;
    header( "Location: " . $baseurl . $url );
    exit ;
?>

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved