Selection of goods in the simplest online store. The document is divided into 2 frames. The first one lists the available goods (at least 5 types) in the form of a small pictogram, name and price per unit. The second frame is a "basket". If the user double-clicks on the product in the first frame, then he is invited to enter the number of product units to be added to the basket in the input line. There is a basket clear button. The cart should be a report that contains information about the product in the cart and the total amount.
1 answer
Use the dblclick event.
Javascript:
var button = document.getElementById(button_id); button.ondblclick = function () { // Код для вывода окна } Jquery:
$(button_selector).dblclick(function () { // Код для вывода окна }); - More details can be - Rasulov Gamzat
ondblclick- double-click event in js. I gave an example of using this event. Instead of the comment " // Code for displaying the window ", you should insert the code that should be executed by double-clicking (in your case, displaying a modal window for entering the number of products) on thebuttonelement (instead ofbutton_id- specify the button id, instead ofbutton_selector- class or id buttons, in your case not a button but a block with the goods). - KRasul- And what is your specific problem, what is available at the moment? Can you give the code as an example? Maybe I didn’t fully understand you - KRasul
- <blink> <script type = "text / javascript"> $ (document) .ready (function () {<code> jQuery ('ditem'). click (function () {console.log ('Click');} ) .dblclick (function () {console.log ('Dblclick');});}); </ script> </ head> <frameset cols = "600, *"> <frame src = "сatalog.html" name = "MENU"> <frame src = "shop.html" name = "CONTENT"> </ frameset> </ blink> And how to work with frames - Rasulov Gamzat
- And why do you do it with frames. Frames can not communicate with each other (or rather their contents), you can not access the contents of the frame from the outside. - KRasul
|