1 <!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">2 <HTMLxmlns= "http://www.w3.org/1999/xhtml">3 <Head>4 <title></title>5 <Scriptsrc= "Scripts/jquery-1.4.1.js"type= "Text/javascript"></Script>6 <styletype= "Text/css">7 *{margin:0px;padding:0px;}8 Body{font-size:12px;}9 Ten . Box{margin:10px;padding:10px;} One . Box H3{margin:10px 0px;Border-bottom:1px solid Red;Padding-bottom:10px;} A . Box P{Line-height:20px;} - - #allbox{margin:10px;padding:10px;} the #allbox Div{Border:5px Solid #aaccff;Margin-top:10px;Height:50px;} - - </style> - <Scripttype= "Text/javascript"> + $(function(){ - $("#allbox Div"). DblClick (function(){ + //This refers to the object that is currently double-clicked A //Pop-up dialog box, confirm when return True, Cancel return false, True when delete is performed at varresult=Window.confirm ("are you sure you want to delete? "); - if(Result==true){ - $( This). Remove (); - } - - }); in - }); to + </Script> - the * </Head> $ <Body>Panax Notoginseng <Divclass= "box"> - <H3>Test request</H3> the <P> +1. When you double-click each sub div of Allbox, the div that you double-clicked is removed from the interface.<BR/> A 2. Pop Up confirmation dialog before deleting, confirm Delete the + </P> - </Div> $ $ <DivID= "Allbox"> - <Div>Box1</Div> - <Div>Box2</Div> the <Div>Box3</Div> - <Div>Box4</Div>Wuyi <Div>Box5</Div> the <Div>Box6</Div> - </Div> Wu - About </Body> $ </HTML>
Double-click event in Web page