shoppingcart.htm

来自「Windows Web脚本开发指南/(美) Dan Heflin, Todd N」· HTM 代码 · 共 40 行

HTM
40
字号
<html>
<script Language="JavaScript">
function dropItem(){
  // In the real application we would add the item to the cart object
  // To make the sample easier we simply display the XML
  displayXML.innerText = event.dataTransfer.getData("Text");  
}
function startDrag(itemID){
  // In the real application we would look up the item by the id
  // To make the sample easier we will hard code the XML
  var source = "<item id='H23199'>";
  source += "<shortDesc>At-A-Glance Daily Desk Calendar Refills - 2000 Dated</shortDesc>";
  source += "<price>2.99</price></item>";
  event.dataTransfer.setData("Text", source);
}
function dragOver(){                                            
  event.returnValue = false;                  
}
</script>
<body>
<p align="center">
<img ID="dropTarget" ondrop="dropItem()" ondragover="dragOver()" 
src="image/cart.gif">
<BR>Click on the image for the item and drop it into the cart.</p>
<p><DIV ID="displayXML">&nbsp;</DIV></p>
<table><thread><th colspan="2">Featured Items</th></thread>
  <tr>
    <td rowspan="2"><img src="image/img2.gif" 
ondragstart="startDrag('H23199')" /></td>
    <td>
      <a href="singleItem.asp?itemID=H23199&amp;catID=ROOT">At-A-Glance 
Daily Desk Calendar Refills - 2000 Dated</a>
    </td>
  </tr>
  <tr>
    <td>Price: $2.99
  </tr>
</table>
</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?