Menukar Aksi 

Copy skrip atau download.
 
<!-- This script has been in the http://www.javascripts.com Javascript Public Library! --> 
<!-- Note that though this material may have been in a public depository, certain author copyright restrictions may apply. --> 
<html> 
<head> 

<!-- 
   see Suzanne Corcorran member:413326 script:"Change The Action" for the original version 
   UPDATED FOR NETSCAPE BY: RYAN GILFETHER - hotrodder@rocketmail.com 
                            BrapTech Web Design - BrapTech@TheOffice.net 
                            http://members.tripod.com/~braptech/ 
                            http://members.tripod.com/~HOTRODDIN/ 
--> 

<script language="JavaScript"> 

function doDirect() 

        var which=document.myform.myelement.selectedIndex; //WHICH OPTION IS SELECTED 

/* REMEBER FOR NETSCAPE IT IS IMPORTANT TO GIVE THE EXCACT LOCATION OF THE FORM 
   USE document.the_form_name.object_in_the_form.value, BESIDES IT IS "PROPER CODING" 
   NETSCAPE IS FUSSY ABOUT THOSE THINGS */ 

        if (document.myform.myelement[which].value=="1") //THE VALUE IS ONLY SET WHEN SOMETHING 
           {document.myform.action="page1.asp";}         //IS SELECTED, INTERNET EXPLORER IS CRAP 
                                                         // SO MOST ANYTHING WORKS, BUT FOR 
        if (document.myform.myelement[which].value=="2") //NETSCAPE YOU HAVE TO SPECIFY THAT THE 
           {document.myform.action="page2.asp";}         //VALUE IS ONLY EQUALL TO SOMETHING WHEN 
                                                         //THE OPTION IS SELECTED 
        if (document.myform.myelement[which].value=="3") 
           {document.myform.action="page3.asp";} 

        if (document.myform.myelement[which].value=="4") 
           {document.myform.action="page4.asp";} 

</script> 

<title>Change the Action *UPDATED* by Ryan Gilfether</title> 
</head> 

<body> 

<!-- FOR THIS TO WORK NETSCAPE REQUIRES YOU TO PUT THE action="" IN THE FORM TAG --> 
<form action="" name="myform" method="post"> 

<input name="sample" size="10" ><br> 

<select name="myelement" size=4 onChange="doDirect();"> 

<option value="1">This is page 1</option> 
<option value="2">This is page 2</option> 
<option value="3">This is page 3</option> 
<option value="4">This is page 4</option> 
</select> 

<INPUT name="Submit" type="submit" value="Submit"> 

</form> 
</body> 
</html> 
 
<!-- Simba says Roar. -->

 
1