ystanev

bidder.html

Mar 25th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.56 KB | None | 0 0
  1. <!DOCTYPE>
  2. <html>
  3.  
  4. <head>
  5.     <title>Bidder</title>
  6. </head>
  7.  
  8. <body>
  9.     <h1>Bidder</h1>
  10.     <form id="bids" action="">
  11.         New Name:
  12.         <span id="n_name"></span>
  13.         <br> Description:
  14.         <span id="description"></span>
  15.         <br> Staring Bid:
  16.         <span id="strt_bid"></span>
  17.         <br>
  18.         <label for="name">Name:</label>
  19.         <input type="text" id="name">
  20.         <br>
  21.         <label for="top_bid">Your Bid:</label>
  22.         <input type="text" id="top_bid">
  23.         <br>
  24.         <input type="submit" value="Submit">
  25.     </form>
  26.  
  27.     <div id="highest_bid"></div>
  28.     <div id="highest_bidder"></div>
  29.     <div id="test"></div>
  30.     <div id="error"></div>
  31.  
  32.     <script src="/socket.io/socket.io.js"></script>
  33.     <script src="https://code.jquery.com/jquery-1.11.1.js"></script>
  34.     <script>
  35.         $(document).ready(function () {
  36.             var socket = io();
  37.  
  38.             //If name is recieved, add it to the HTML page
  39.             socket.on("delivername", function (n_name) {
  40.                 $("#n_name").html(n_name);
  41.             });
  42.  
  43.             // Submit the bid, if user clicks submit button
  44.             $("#bids").submit(function () {
  45.  
  46.                 // Send message to the server with the bid
  47.                 socket.emit("top_bid", $("#top_bid").val());
  48.  
  49.                 // Override the default form submit behaviour
  50.                 return false;
  51.             });
  52.            
  53.             // If a result is received, show the user...
  54.  
  55.             //CODE HERE
  56.  
  57.         });
  58.     </script>
  59. </body>
  60.  
  61. </html>
Add Comment
Please, Sign In to add comment