$(document).ready(function() {
     $("#subbut").click(function(){
     var url = 'createBuy.action';
var params = {};
$.post(url, params, callback, 'json');
     });
    });
    
    var i = 0;
    var materials;
    
    function callback(data){
     if (data == null) {
alert('登录超时,请重新登录');
window.close();
window.dialogArguments.loginout();
return false;
}
     $("#tb").html("");
     if(null != data.buy_materials){
     //alert("sdfsdf");
     materials = data.buy_materials;
     var date = new Date();
     var htmlText = "<table class='td' id=\"td\" cellspacing=\"0\" align=\"center\">";
     htmlText = htmlText + "<thead><tr class=\"trtitle\"><td>时间:</td><td colspan='6'>"
     + date.getYear() + "-" + (date.getMonth() + 1) + "-"
     + date.getDate() + "</td></tr>";
     htmlText = htmlText + "<tr class=\"trtitlew\"><td colspan='7'>"+
          "<a style=\"cursor:hand; font-weight:bolder; border:black solid; border-width:1px 1px 1px 1px\" onclick=\"addBuy('" + materials + "')\">添加采购单项<a/>"+
          "</td></tr></thead>";
          htmlText = htmlText + "<tfoot><tr class=\"trtitlew\"><td colspan='7'><input class='sub' onclick='buysub()' id='buy_sub' type='button' value='提交'/></td></tr></tfoot>";
          htmlText = htmlText + "</table>"; 
     //alert(htmlText);
     $("#tb").append(htmlText);
     addBuy(materials);
     }可能是在<a> 标签中的函数 addBuy()中的参数有问题,请叫各位大神怎么改。