otra cosa si me dicen si esta biem por que tiene que funcionar con un archivo php y una base de datos
codigo html+javascript
Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>rincondelcodigo.com</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <div style="position: absolute; width: 358px; height: 286px; z-index: 1; left: 10px; top: 15px" id="capa1"> <FORM name="isc"> <table border="0" cellspacing="0" cellpadding="0"> <tr align="center"> <td nowrap height="11"> <select name="example" size="1" onChange="redirect(this.options.selectedIndex)"> <option selected>---Select1-------------</option> <option>Webmaster Sites</option> <option>News Sites</option> </select> <select name="stage2" size="1" onChange="redirect1(this.options.selectedIndex)"> <option value=" " selected> </option> <option value=" " selected>---Select2--------------</option> <option value=" " selected>---Select2--------------</option> </select> <select name="stage3" size="1" onChange="redirect2(this.options.selectedIndex)"> <option value=" " selected> </option> <option value=" " selected>---Select3----------------</option> <option value=" " selected>---Select3----------------</option> </select> <script> <!-- var groups=document.isc.example.options.length var group=new Array(groups) for (i=0; i<groups; i++) group[i]=new Array() group[0][0]=new Option("---Select2---"," "); group[1][0]=new Option("Now Select This One"," "); group[1][1]=new Option("JavaScript","47"); group[1][2]=new Option("CSS","46"); group[1][3]=new Option("Ajax","45"); group[2][0]=new Option("Now Select This One"," "); group[2][1]=new Option("General News","115"); group[2][2]=new Option("Technology News","116"); var temp=document.isc.stage2 function redirect(x){ for (m=temp.options.length-1;m>0;m--) temp.options[m]=null for (i=0;i<group[x].length;i++){ temp.options[i]=new Option(group[x][i].text,group[x][i].value) } temp.options[0].selected=true redirect1(0) } var secondGroups=document.isc.stage2.options.length var secondGroup=new Array(groups) for (i=0; i<groups; i++) { secondGroup[i]=new Array(group[i].length) for (j=0; j<group[i].length; j++) { secondGroup[i][j]=new Array() }} secondGroup[0][0][0]=new Option("---Select 3---"," "); secondGroup[1][0][0]=new Option("---Select 3---"," "); secondGroup[1][1][0]=new Option("Now Select This One"," "); secondGroup[1][1][1]=new Option("JavaScript Kit","http://javascriptkit.com"); secondGroup[1][1][2]=new Option("Dynamic Drive","http://www.dynamicdrive.com"); secondGroup[1][1][3]=new Option("Java-Scripts.net","http://java-scripts.net"); secondGroup[1][2][0]=new Option("Now Select This One"," "); secondGroup[1][2][1]=new Option("CSS Drive","http://www.cssdrive.com"); secondGroup[1][2][2]=new Option("CSS Library","http://www.dynamicdrive.com/style/"); secondGroup[1][2][3]=new Option("CSS Help Forums","http://www.codingforums.com/forumdisplay.php?f=13"); secondGroup[1][3][0]=new Option("Now Select This One"," "); secondGroup[1][3][1]=new Option("Ajaxian","http://www.ajaxian.com"); secondGroup[1][3][2]=new Option("Ajax Scripts","http://www.javascriptkit.com/script/cutindex11.shtml"); secondGroup[2][0][0]=new Option("---Select 3---"," "); secondGroup[2][1][0]=new Option("Now Select This One"," "); secondGroup[2][1][1]=new Option("CNN","http://www.cnn.com"); secondGroup[2][1][2]=new Option("MSNBC","http://www.msnbc.com"); secondGroup[2][1][3]=new Option("ABC News","http://www.abcnews.com"); secondGroup[2][2][0]=new Option("Now Select A Page"," "); secondGroup[2][2][1]=new Option("News.com","http://www.news.com"); secondGroup[2][2][2]=new Option("Wired","http://www.wired.com"); var temp1=document.isc.stage3 function redirect1(y){ for (m=temp1.options.length-1;m>0;m--) temp1.options[m]=null for (i=0;i<secondGroup[document.isc.example.options.selectedIndex][y].length;i++){ temp1.options[i]=new Option(secondGroup[document.isc.example.options.selectedIndex][y][i].text,secondGroup[document.isc.example.options.selectedIndex][y][i].value) } temp1.options[0].selected=true } function redirect2(z){ window.location=temp1[z].value } //--> </script> </td> </tr> </table> </FORM> </div> </body> </html>
codigo php interactivo con el form
Código:
solo nesesito que me corten el codigo javascritp<?php //Primero comprovamos datos que no esten vacion if(isset($_POST['namepj']) && !empty($_POST['namepj']) && isset($_POST['raza']) && !empty($_POST['raza']) && isset($_POST['prof']) && !empty($_POST['prof']) && isset($_POST['sexo']) && !empty($_POST['sexo']) && isset ($_POST['edad']) && !empty($_POST['edad'])) { //entrando a la base de datos $link = mysql_connect("127.0.0.1","user","123"); mysql_select_db("ged",$link); // con esta sentencia insertamos los datos en la base de datos XD mysql_query("INSERT INTO pj (namepj,raza,prof,sexo,edad,apa) VALUES ('{$_POST['namepj']}','{$_POST['raza']}','{$_POST['prof']}','{$_POST['sexo']}','{$_POST['edad']}','{$_POST['apa']}')",$link); // Ahora comprobaremos que todo ha ido correctamente $my_error = mysql_error($link); if(!empty($my_error)) { echo "Ha habido un error al insertar los valores. $my_error"; } else { header("Location: juego.html"); } } else { echo "Error, no ha introducido todos los datos"; } ?>
yo e editado esto asta aki
Código:
no se lo que tengo demas o que tengo que eliminar<script> <!-- var groups=document.form1.raza.options.length var group=new Array(groups) for (i=0; i<groups; i++) group[i]=new Array() group[0][0]=new Option("---Select2---"," "); group[1][0]=new Option("Selecione una Profeción"," "); group[1][1]=new Option("Guerrero","guerrero"); group[1][2]=new Option("Paladin(Caballero)","paladin"); group[1][3]=new Option("Mercenario(Asesino)","mercenario"); group[1][4]=new Option("Sacerdote","sacerdote"); group[1][5]=new Option("Mago","mago"); group[1][6]=new Option("Brujo","brujo"); group[2][0]=new Option("Selecione una Profeción"," "); group[2][1]=new Option("Paladin(Caballero)","paladin"); group[2][2]=new Option("Mago","mago"); group[2][3]=new Option("Sacerdote","sacerdote"); group[3][0]=new Option("Selecione una Profeción"," "); group[3][1]=new Option("Guerrero","guerrero"); group[3][2]=new Option("Paladin(Caballero)","paladin"); group[3][3]=new Option("Cazador","116"); group[4][0]=new Option("Selecione una Profeción"," "); group[4][1]=new Option("Guerrero","guerrero"); group[4][2]=new Option("Paladin(Caballero)","paladin"); group[4][3]=new Option("Mago","mago"); group[4][4]=new Option("Sacerdote","sacerdotes"); var temp=document.form1.prof function redirect(x){ for (m=temp.options.length-1;m>0;m--) temp.options[m]=null for (i=0;i<group[x].length;i++){ temp.options[i]=new Option(group[x][i].text,group[x][i].value) } temp.options[0].selected=true redirect1(0) } var secondGroups=document.form1.prof.options.length var secondGroup=new Array(groups) for (i=0; i<groups; i++) { secondGroup[i]=new Array(group[i].length) for (j=0; j<group[i].length; j++) { secondGroup[i][j]=new Array() }} secondGroup[0][0][0]=new Option("---Select 3---"," "); secondGroup[1][0][0]=new Option("---Select 3---"," "); secondGroup[1][1][0]=new Option("Now Select This One"," "); secondGroup[1][1][1]=new Option("JavaScript Kit","http://javascriptkit.com"); secondGroup[1][1][2]=new Option("Dynamic Drive","http://www.dynamicdrive.com"); secondGroup[1][1][3]=new Option("Java-Scripts.net","http://java-scripts.net"); secondGroup[1][2][0]=new Option("Now Select This One"," "); secondGroup[1][2][1]=new Option("CSS Drive","http://www.cssdrive.com"); secondGroup[1][2][2]=new Option("CSS Library","http://www.dynamicdrive.com/style/"); secondGroup[1][2][3]=new Option("CSS Help Forums","http://www.codingforums.com/forumdisplay.php?f=13"); secondGroup[1][3][0]=new Option("Now Select This One"," "); secondGroup[1][3][1]=new Option("Ajaxian","http://www.ajaxian.com"); secondGroup[1][3][2]=new Option("Ajax Scripts","http://www.javascriptkit.com/script/cutindex11.shtml"); secondGroup[2][0][0]=new Option("---Select 3---"," "); secondGroup[2][1][0]=new Option("Now Select This One"," "); secondGroup[2][1][1]=new Option("CNN","http://www.cnn.com"); secondGroup[2][1][2]=new Option("MSNBC","http://www.msnbc.com"); secondGroup[2][1][3]=new Option("ABC News","http://www.abcnews.com"); secondGroup[2][2][0]=new Option("Now Select A Page"," "); secondGroup[2][2][1]=new Option("News.com","http://www.news.com"); secondGroup[2][2][2]=new Option("Wired","http://www.wired.com"); var temp1=document.form1.stage3 function redirect1(y){ for (m=temp1.options.length-1;m>0;m--) temp1.options[m]=null for (i=0;i<secondGroup[document.form1.example.options.selectedIndex][y].length;i++){ temp1.options[i]=new Option(secondGroup[document.form1.example.options.selectedIndex][y][i].text,secondGroup[document.form1.example.options.selectedIndex][y][i].value) } temp1.options[0].selected=true } function redirect2(z){ window.location=temp1[z].value } //--> </script>
PD:cabe observar que meti cada select en diferentes capas a ver si los lograva alinear y que no se vieran tan desiguales