gkman פורסם 2012 במרץ 18 Share פורסם 2012 במרץ 18 שלום.יש לי את העמוד הזה (נוצר כתוצאה סופית של קוד PHP):<!DOCTYPE HTML><html> <head> <title> TorahForMe.org </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Language" content="he-IL" /> <script>function populate_cat() { document.getElementById("sel_cat").options[0]=new Option("Bible", "1", true, false);document.getElementById("sel_cat").options[1]=new Option("Gemarah", "2", false, false);document.getElementById("sel_cat").options[2]=new Option("Halacha", "3", false, false);document.getElementById("sel_cat").options[3]=new Option("Hebrew", "4", false, false);}function populate_sub() { document.getElementById("sel_sub").options.length=0; cat = document.getElementById("sel_cat").value; switch(cat){ case 1:document.getElementById("sel_sub").options[0] = new Option("Genesis", "1", true, false);document.getElementById("sel_sub").options[1] = new Option("Daniel", "5", false, false);break;case 2:document.getElementById("sel_sub").options[0] = new Option("Kidushim", "4", true, false);document.getElementById("sel_sub").options[1] = new Option("Ta'anit", "6", false, false);break;case 3:document.getElementById("sel_sub").options[0] = new Option("Rif", "3", true, false);break;case 4:document.getElementById("sel_sub").options[0] = new Option("Q and A", "2", true, false); break; }}</script> </head> <body onload="populate_cat()"> <div style="border: 0px solid black; clear: both; background-color: black; color: white; width: 100%; padding: 2px;"> Welcome, Admin<style> .topmenu a:link{color: white; text-decoration: none; } .topmenu a:visited {color: white; text-decoration: none; } .topmenu a:hover{color: white; text-decoration: underline;}</style><span style="float:right" class="topmenu"> <a href="#"> Change Password </a> | <a href="auth.php?log=out"> Log Out </a></span> </div> <div style=" vertical-align:top; float: left; border: 0px solid black; width: 200px; padding: 0px;"> <div style=" vertical-align:top; float: left; border: 0px solid black; width: 200px; padding: 5px; background-color:#eeeeee; margin-top: 5px;"> <!--MENU--> <a href="edit_m.php"> Edit Podcast's Menu </a> <br /> Edit Podcast's <!--MENU--></div> </div> <div style="margin-left:220px; border: 0px solid black; padding: 5px; "> <form name="get_menu" id="get_menu"> <select name="sel_cat" id="sel_cat" onchange="populate_sub()"> </select> <select name="sel_sub" id="sel_sub"> </select> </form> </div> </body></html>שאני לא מצליח להבין למה כשאני משנה את השדה sel_cat לא מתבצע איכלוס של השדה sel_sub. ביזבזתי על הבעיה הזאת לפחות שעה וחצי וזה מתסכל בטירוף. תודה מראש לעוזרים. קישור לתוכן שתף באתרים אחרים More sharing options...
yonizaf פורסם 2012 במרץ 18 Share פורסם 2012 במרץ 18 הערך של select.value הוא מחרוזת (string) ולא מספר.אתה צריך לעשות גרשיים מסביב למספר בcase:switch(cat){ case "1": etc;} קישור לתוכן שתף באתרים אחרים More sharing options...
gkman פורסם 2012 במרץ 18 מחבר Share פורסם 2012 במרץ 18 תודה זה עובד מצוין עכשיו. קישור לתוכן שתף באתרים אחרים More sharing options...
Recommended Posts
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.