PHP interesse |
|
Beste,
Haytjes is zo vriendelijk geweest voor mij een scriptje te maken in javascript.
Hier komen dan de codes van zijn script (dat zoals je het zal zien werkt) ... en het mijne waar ik via php de javascript array's vul ... en zoals je al kan raden werkt de myne niet anders zou ik het niet posten:'(
http://www.clipvakanties.be/~pj/site/test.htm
<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
<!--
var postname = "test";
var arr = new Array();
arr[0] = new Array();
arr[0]["options"] = Array(1,2);
arr[1] = new Array();
arr[1]['name'] = "Engeland";
arr[1]['options'] = Array(5,6);
arr[2] = new Array();
arr[2]['name'] = "Duitsland";
arr[2]['options'] = Array(3,4);
arr[3] = new Array();
arr[3]['name'] = "Volkswagen";
arr[3]['options'] = Array(7,8);
arr[4] = new Array();
arr[4]['name'] = "Mercedes";
arr[4]['options'] = "";
arr[5] = new Array();
arr[5]['name'] = "Old timer";
arr[5]['options'] = "";
arr[6] = new Array();
arr[6]['name'] = "Jaquar";
arr[6]['options'] = "";
arr[7] = new Array();
arr[7]['name'] = "Golf";
arr[7]['options'] = "";
arr[8] = new Array();
arr[8]['name'] = "Tuareg";
arr[8]['options'] = "";
function doe(i,diep)
{
var diep = diep*1;
if(typeof(arr[i]["options"]) == "object")
{
var oSelect = document.createElement("select");
oSelect.name = postname;
oSelect.id = "select"+diep;
oSelect.onchange = function(){
tmp = this.value.split(",");
if(tmp[0]&&tmp[1])
{
wis(tmp[1]);
doe(tmp[0],tmp[1]);
}
};
y = arr[i]["options"].length;
document.getElementById("container_choice").appendChild(oSelect);
oSelect.options[0] = new Option("Select","");
for(x=0;x<y;x++)
{
oSelect.options[x+1] = new Option(arr[arr[i]["options"][x]]["name"],Array(arr[i]["options"][x],diep+1));
}
}
}
function wis(diep)
{
var x = diep*1;
while(document.getElementById("select"+x))
{
document.getElementById("select"+x).parentNode.removeChild(document.getElementById("select"+x));
x++;
}
}
window.onload = function(){ doe(0,0) };
-->
</script>
</head>
<body>
<form method='GET'>
<div id="container_choice">
</div>
<input type='submit'>
</form>
</body>
</html>
<html> <head> <title>Untitled</title> <script type="text/javascript"> <!-- var postname = "test"; arr [0]["options"] = Array(1,2); arr[1]['name'] = "Engeland"; arr [1]['options'] = Array(5,6);arr[2]['name'] = "Duitsland"; arr [2]['options'] = Array(3,4); arr[3]['name'] = "Volkswagen"; arr [3]['options'] = Array(7,8);arr[4]['name'] = "Mercedes"; arr[4]['options'] = ""; arr[5]['name'] = "Old timer"; arr[5]['options'] = ""; arr[6]['name'] = "Jaquar"; arr[6]['options'] = ""; arr[7]['name'] = "Golf"; arr[7]['options'] = ""; arr[8]['name'] = "Tuareg"; arr[8]['options'] = ""; function doe(i,diep) { var diep = diep*1; if(typeof(arr[i]["options"]) == "object") { var oSelect = document.createElement("select"); oSelect.name = postname; oSelect.id = "select"+diep; oSelect.onchange = function(){ tmp = this .value .split(","); if(tmp[0]&&tmp[1]) { wis(tmp[1]); doe(tmp[0],tmp[1]); } }; y = arr[i]["options"].length; document.getElementById("container_choice").appendChild(oSelect); oSelect.options[0] = new Option("Select",""); for(x=0;x<y;x++) { oSelect .options [x +1] = new Option (arr [arr [i ]["options"][x ]]["name"],Array(arr [i ]["options"][x ],diep +1)); } } } function wis(diep) { var x = diep*1; while(document.getElementById("select"+x)) { document.getElementById("select"+x).parentNode.removeChild(document.getElementById("select"+x)); x++; } } window.onload = function(){ doe(0,0) }; --> </script> </head> <body> <form method='GET'> <div id="container_choice"> </div> <input type='submit'> </form> </body> </html>
http://www.clipvakanties.be/~pj/site/test2.php
<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
<!--
var postname = "test";
var arr = new Array();
arr[0] = new Array();
arr[0]["options"] = Array(26,20,28);
var arr[26] = new Array();
arr[26]['name'] = "Moni's"
arr[26]['options'] = Array(27);
var arr[20] = new Array();
arr[20]['name'] = "Taalvakanties"
arr[20]['options'] = Array(22,21);
var arr[28] = new Array();
arr[28]['name'] = "ski"
arr[28]['options'] = Array(29,30);
var arr[22] = new Array();
arr[22]['name'] = "Engels"
arr[22]['options'] = Array(31,32);
var arr[21] = new Array();
arr[21]['name'] = "Frans"
arr[21]['options'] = Array(24,25,23);
var arr[27] = new Array();
arr[27]['name'] = "Moni's only"
arr[27]['options'] = Array(33);
var arr[29] = new Array();
arr[29]['name'] = "met taalprogramma"
arr[29]['options'] = "";
var arr[30] = new Array();
arr[30]['name'] = "zonder taalprogramma"
arr[30]['options'] = "";
var arr[24] = new Array();
arr[24]['name'] = "Braives"
arr[24]['options'] = ""
var arr[31] = new Array();
arr[31]['name'] = "Ierland"
arr[31]['options'] = ""
var arr[32] = new Array();
arr[32]['name'] = "Malta"
arr[32]['options'] = ""
var arr[25] = new Array();
arr[25]['name'] = "Nessonvaux"
arr[25]['options'] = ""
var arr[23] = new Array();
arr[23]['name'] = "Villeneuve"
arr[23]['options'] = ""
var arr[33] = new Array();
arr[33]['name'] = "speciale pagina"
arr[33]['options'] = ""
function doe(i,diep)
{
var diep = diep*1;
if(typeof(arr[i]["options"]) == "object")
{
var oSelect = document.createElement("select");
oSelect.name = postname;
oSelect.id = "select"+diep;
oSelect.onchange = function(){
tmp = this.value.split(",");
if(tmp[0]&&tmp[1])
{
wis(tmp[1]);
doe(tmp[0],tmp[1]);
}
};
y = arr[i]["options"].length;
document.getElementById("container_choice").appendChild(oSelect);
oSelect.options[0] = new Option("Select","");
for(x=0;x<y;x++)
{
oSelect.options[x+1] = new Option(arr[arr[i]["options"][x]]["name"],Array(arr[i]["options"][x],diep+1));
}
}
}
function wis(diep)
{
var x = diep*1;
while(document.getElementById("select"+x))
{
document.getElementById("select"+x).parentNode.removeChild(document.getElementById("select"+x));
x++;
}
}
window.onload = function(){ doe(0,0) };
-->
</script>
</script>
</head>
<body>
<form method='GET'>
<div id="container_choice">
</div>
<input type='submit'>
</form>
</body>
</html>
<html> <head> <title>Untitled</title> <script type="text/javascript"> <!-- var postname = "test"; arr [0]["options"] = Array(26,20,28); var arr [26] = new Array(); arr[26]['name'] = "Moni's" arr [26]['options'] = Array(27); var arr [20] = new Array(); arr[20]['name'] = "Taalvakanties" arr [20]['options'] = Array(22,21); var arr [28] = new Array(); arr[28]['name'] = "ski" arr [28]['options'] = Array(29,30); var arr [22] = new Array(); arr[22]['name'] = "Engels" arr [22]['options'] = Array(31,32); var arr [21] = new Array(); arr[21]['name'] = "Frans" arr [21]['options'] = Array(24,25,23); var arr [27] = new Array(); arr[27]['name'] = "Moni's only" arr [27]['options'] = Array(33); var arr [29] = new Array(); arr[29]['name'] = "met taalprogramma" arr[29]['options'] = ""; var arr [30] = new Array(); arr[30]['name'] = "zonder taalprogramma" arr[30]['options'] = ""; var arr [24] = new Array(); arr[24]['name'] = "Braives" arr[24]['options'] = "" var arr [31] = new Array(); arr[31]['name'] = "Ierland" arr[31]['options'] = "" var arr [32] = new Array(); arr[32]['name'] = "Malta" arr[32]['options'] = "" var arr [25] = new Array(); arr[25]['name'] = "Nessonvaux" arr[25]['options'] = "" var arr [23] = new Array(); arr[23]['name'] = "Villeneuve" arr[23]['options'] = "" var arr [33] = new Array(); arr[33]['name'] = "speciale pagina" arr[33]['options'] = "" function doe(i,diep) { var diep = diep*1; if(typeof(arr[i]["options"]) == "object") { var oSelect = document.createElement("select"); oSelect.name = postname; oSelect.id = "select"+diep; oSelect.onchange = function(){ tmp = this .value .split(","); if(tmp[0]&&tmp[1]) { wis(tmp[1]); doe(tmp[0],tmp[1]); } }; y = arr[i]["options"].length; document.getElementById("container_choice").appendChild(oSelect); oSelect.options[0] = new Option("Select",""); for(x=0;x<y;x++) { oSelect .options [x +1] = new Option (arr [arr [i ]["options"][x ]]["name"],Array(arr [i ]["options"][x ],diep +1)); } } } function wis(diep) { var x = diep*1; while(document.getElementById("select"+x)) { document.getElementById("select"+x).parentNode.removeChild(document.getElementById("select"+x)); x++; } } window.onload = function(){ doe(0,0) }; --> </script> </script> </head> <body> <form method='GET'> <div id="container_choice"> </div> <input type='submit'> </form> </body> </html>
PS: Nutteloos te zeggen dat haytjes zeker weet wat het probleem is want dat hij spijtig genoeg (!nog!) niet.
Of je test.htm in jouw site wilt gebruiken moet je maar vragen aan haytjes
Alvast bedankt,
Pj
|