Вот код, когда names вывожу через document.write, все работает, а когда так делаю выдает ошибку:
TypeError: document.this is undefined
Извиняюсь, язык учу пару дней только
<form name="getdate">
<select name="reldate" id="reldate">
<?php
$query = ("SELECT * FROM af_page group by af_date");
$result = mysql_query($query);
$row = mysql_num_rows($result);
if($row>0){
while ($row = mysql_fetch_assoc($result)){
$af_id = $row['id'];
$af_text = $row['af_god'];
$af_mesac = $row['af_mesac'];
$af_day = $row['af_day'];
$af_img = $row['af_img'];
$af_god = $row['af_god'];
$fulldate = $af_day . $af_mesac . $af_god;
echo '<option onchange = "this.value" onclick="geval();" value="'.$fulldate.'">'.$fulldate.'</option>';
}}
?>
</select><script>
function geval() {
var names = document.getdate.reldate.value;
function getXmlHttp(){
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
var req = getXmlHttp()
var fulldate = document.this.value.fulldate
var statusElem = document.getElementById('vote_status')
req.onreadystatechange = function() {
if (req.readyState == 4) {
statusElem.innerHTML = req.statusText;
if(req.status == 200) {
statusElem.innerHTML = req.responseText;
}
}
}
req.open('GET', '../test/af_add.php?names='+names, true)
req.send('null');
statusElem.innerHTML = 'Ожидаю ответа сервера...'
}
</script>
</form>