<script language="javascript">
var theCartWindow = null;
function openCartWindow()
{
    if (!theCartWindow || theCartWindow.closed)
        theCartWindow = window.open("about:blank", "theCartWindow", "width=150;height=100");
    theCartWindow.focus();
}
</script>
<a href="###" onclick="openCartWindow()">Open shopping cart</a>

解决方案 »

  1.   

    可不可以用php控制,而不要用js控制啊?我的代码是这样的
    if ($_SERVER['REQUEST_METHOD'] == "GET") {
    switch ($_GET["act"]) {
      //增加物品
      case "add":
        $iNo = $_GET["id"];
          if ($iNo != '') $SQL = "and D.InvNo=$iNo";
          $rs->close;
          $rs->open("select S.Discount,D.DBID,D.Unit,D.InvNo,D.CategoryNo,D.InvName,D.UnitPrice,D.MemberPrice,D.Qty from DTInventory D
              inner join SADiscount S on D.DBID=S.DBID and D.InvNo=S.OwerNo 
              where D.DBID=$_DBID ".$SQL." limit 1");
          $row = $rs->getRow();
        $_CART->Add($row["InvNo"], $row["InvName"], $row["UnitPrice"], $row["Discount"], $row["MemberPrice"], $row["Qty"], 1);
        echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=shopcart.php\">";  
        break;
        //删除物品
        case "del":
          $id = $_GET["no"];
          $_CART->Remove($id);
          echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=shopcart.php\">";  
          break;
        case "clear":
          $_CART->RemoveAll();
          echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=shopcart.php\">";  
          break;
    }
    }