我有这两个文件:
new_aircraft.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="STYLESHEET" type="text/css" href="./style.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Insert Aircraft</title>
</head>
<body>
<script>
//Ajax Script
function require(){
try{
req = new XMLHttpRequest();
}catch(err1){
try{
req = new ActiveXObject("Microsoft.XMLHTTP");
}catch(err2){
try{
req = new ActiveXObject("Msxml2.XMLHTTP");
}catch(err3){
req = false;
}
}
}
return req;
}
var request = require();
function callAjax(){
var ramdom = parseInt(Math.random()*999999999);
valor = document.getElementById("numberclasses").value;
var url="classes.php?Value="+valor+"&r="+ramdom;
request.open("GET",url,true);
request.onreadystatechange = answerAjax;
request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
request.send(null);
}
function answerAjax(){
if(request.readyState==4){
if(request.status==200){
//alert(request.responseText);
document.getElementById("classes").innerHTML=request.responseText;
}else{
alert("ha ocurrido un error"+request.statusText);
}
}
}
</script>
<?
$boton = $_POST['enviar'];
$nombre = $_POST['nombre'];
$precio = $_POST['precio'];
$pax = $_POST['pax'];
$ICAO = $_POST['ICAO'];
if($boton == 'Insertar')
{
include('./db.inc.php');
$ICAO = strtoupper($ICAO);
mysql_query("INSERT INTO flota(ICAO, nombre, precio, capacidad) VALUES('$ICAO', '$nombre', '$precio', '$pax')") or die('<h4 style="color: red;">Ha habido un problema con la insercion.</h4>');
mysql_close();
echo '<h3 style="color: green;">Aeronave adquirida correctamente.<h3/>';
}
else
{
?>
<form action="insertar-modelo.php" method="post" enctype="application/x-www-form-urlencoded">
<table>
<tr><td class=Forms>ICAO: </td><td><input type="text" value="" name="ICAO" /></td></tr>
<tr><td class=Forms>Name: </td><td><input type="text" value="Airbus A320" name="nombre" /></td></tr>
<tr><td class=Forms>Price: </td><td><input maxlength="9" value="1000000" type="text" name="precio" /> €</td></tr>
<tr><td class=Forms>Number Classes: </td></td><td><select name="numberclasses" id="numberclasses" onchange="callAjax()">
<option>Select Number of Classes</option>
<?php
echo'<option value="1">One</option>';
?>
</select></td></tr>
<tr><td id="classes" ></td></tr>
<tr><td class=Forms>Capacidad: </td><td><input maxlength="3" value="150" type="text" name="pax" /> pasajeros</td></tr>
</table><br />
<input type="submit" name="enviar" value="Insertar"/>
</form>
<?
}
?>
</body>
</html>
类.php
<?php
$value = $_GET['Value'];
if($value == 1){
?>
<thead>
<td class=Forms>First Class: </td><td><input maxlength="3" value="150" type="text" name="pax" /></td>
</thead>
<?php
}
?>
而当我“选择类数”1时的结果是http://i48.tinypic.com/erbfnn.png(这是一张图片,请看)。
头等舱部分的顺序不正确。它应该低于 Number Classes,但它是第一个。头等舱部分不尊重其他部分的宽度。
我该如何解决?