a.html
- Kod: Zaznacz cały
liczby = new Array("1","2");
b.html
- Kod: Zaznacz cały
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>liczby i litery</title>
<script src="advajax.js" type="text/javascript"></script>
<script type="text/javascript">
function sendi(sel){
var id = sel.options[sel.selectedIndex].value;
var temp = document.getElementById('litery');
if(id==0)
temp.options.length = 1;
else {
advAJAX.submit(document.getElementById('form'), {
url : 'a.html',
onSuccess : function(obj){
alert('asd');
eval(obj.responseText);
alert(obj.responseText)
temp.options.length = 0;
for(i=0; i<liczby.length; i++)
temp.options[i] = new Option(liczby[i], "");
temp.options[0].selected=true;
}
});
}
}
</script>
</head>
<body>
<form action="b.html" method="POST" id="form">
<select name="litery" onchange="sendi(this)" >
<option value="1">a</option>
<option value="2">b</option>
</select>
<select name="liczby" id="liczby">
</select>
</form>
</body>
</html>
teraz odpalam plik b.html i sprawdzam konsole okazuje się że jest w niej bład składni. Na czym polega błąd ponieważ ja już naprawde nie wiem co jest grane