var hits = function (id) { this.id = id; this.type = "getnewshits()"; this.callmethod = "getnewshits()"; } hits.prototype = { getnewshits: function () { this.type = "getnewshits()"; this.callmethod = "getnewshits()"; this.gethitsajax(); }, getproducthits: function () { this.type = "getproducthits()"; this.callmethod = "getproducthits()"; this.gethitsajax(); }, getdownloadhits: function () { this.type = "getdownloadhits()"; this.callmethod = "getdownloadhits()"; this.gethitsajax(); }, getcasehits: function() { this.type = "getcasehits()"; this.callmethod = "getcasehits()"; this.gethitsajax(); }, getjobhits: function() { this.type = "getjobhits()"; this.callmethod = "getjobhits()"; this.gethitsajax(); }, getvideohits: function() { this.type = "getvideohits()"; this.callmethod = "getvideohits()"; this.gethitsajax(); }, getreservehits: function() { this.type = "getreservehits()"; this.callmethod = "getreservehits()"; this.gethitsajax(); }, gethitsajax: function () { $.ajax({ type: "post", url: "/ajaxfile/gethits.ashx", async: false, data: { type: this.type, callmethod: this.callmethod, id: this.id }, success: function (data) { html = data; } }); return document.write(html); } } //页面用法: