21,891
社区成员
发帖
与我相关
我的任务
分享<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function changeform(value) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", "post.php?action"+value, true);
xmlHttp.send(null);
}
function handleStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
alert("The server replied with: " + xmlHttp.responseText);
}
}
}
</script>
<script language='javascript'>
function changeform(this.value)
{
if(this.value == "invitation")
{
display();
}
else if(this.value == "response")
{
display();
}
else if(this.value == "reception")
{
display();
}
}
function display()
{
//如果不想一次加载,可以用ajax动态获取
//如果一次加载,只是隐藏了,可以调用document.getElementById('xxx')来显示或者隐藏
}
</script>
//onclick代替onchange,
<select name="s1" onclick="changeform(this.value)">
<option value='invitation'>invitation </option>
<option value='response'>response </option>
<option value='reception'>reception </option>
</select>