Home > Web Front-end > HTML Tutorial > 为什么会出现警告??_html/css_WEB-ITnose

为什么会出现警告??_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:38:04
Original
1191 people have browsed it

本帖最后由 yczhaoliao 于 2012-09-25 19:36:52 编辑

var xmlhttp;
function $(id){
return document.getElementById(id);
}
function createXmlHttpRequest(){
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e1) {
try {
xmlhttp = new XMLHttpRequest();
if(xmlhttp.overrideMimeType){
xmlhttp.overrideMimeType("text/xml");
}
} catch (e2) {
}
}
}
}
function update(bid,price){
createXmlHttpRequest();
var count = $("count").value;
var url = "Modify?bid="+bid+"&count="+count+"&price="+price;

xmlhttp.open("post", url, true);
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 4){
if(xmlhttp.status == 200){
var str = xmlhttp.responseText;
var price = $("price").value;
var t_price = count*price;
total.innerHTML = ""+t_price+"";
}
}
} 这个地方会出现警告(就旁边这个中括号)。不知道为什么?
xmlhttp.send(null);
}

回复讨论(解决方案)

这样不报错了。

var xmlhttp;function $(id){	return document.getElementById(id);}function createXmlHttpRequest(){	try {		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");	} catch (e) {		try {			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");		} catch (e1) {			try {				xmlhttp = new XMLHttpRequest();				if(xmlhttp.overrideMimeType){					xmlhttp.overrideMimeType("text/xml");				}			} catch (e2) {			}		}	}}function update(bid,price){	createXmlHttpRequest();	var count = $("count").value;	var url = "Modify?bid="+bid+"&count="+count+"&price="+price;	xmlhttp.open("post", url, true);	xmlhttp.onreadystatechange = function(){		if(xmlhttp.readyState == 4){			if(xmlhttp.status == 200){				var str = xmlhttp.responseText;				var price = $("price").value;				var t_price = count*price;				total.innerHTML = ""+t_price+"";			}		}	}	xmlhttp.send(null);}
Copy after login

楼主先把格式整理一下吧,这样方便别人阅读,也方便自己找错

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template