Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I need a simple java script or html code for simple inventory

    I need a simple java script or html code for simple inventory

    Hi! I am trying to design a simple page that will show the list of usernames that are available and can be grab (when I say Grab, i will just basically change/update the name of the owner of the username) even if its taken already. What I am trying to achieve here is when someone grab one of the usernames, the button will turn red and also update the name inside the the third column cell labeled "Used By".

    I need a simple java script or html code for simple inventory-user.jpg

    Below is my basic html code:

    <table class="tftable" border="1">
    <tr bgcolor="yellow"><td>User Name List</td><td> Status </td> <td>Used By</td></tr>
    <tr><td>User1 </td><td bgcolor="green"> </td ><td>Available</td></tr>
    <tr><td>User2 </td><td bgcolor="green"> </td><td>Available</td></tr>
    <tr><td>User3 </td><td bgcolor="red"> </td><td>Troy</td></tr>
    <tr><td>User4 </td><td bgcolor="green"> </td><td>Available</td></tr>
    <tr><td>User5</td><td bgcolor="red"> </td><td>John</td></tr>
    <tr><td>User6</th><td bgcolor="green"> </td><td>Available</td></tr>
    <tr><td>User7 </td><td bgcolor="red"> </td><td>Available</td></tr>
    <br>
    </table>
    <form>
    <select name="userlist">
    <option value="User1">User1</option>
    <option value="User2">User2</option>
    <option value="User3">User3</option>
    <option value="User4">User4</option>
    <option value="User5">User5</option>
    <option value="User6">User6</option>
    <option value="User7">User7</option>
    </select>
    <br>
    <form method="post">
    <textarea cols="20" rows="1">Type your name here</textarea>
    <br>
    <input type="button" value="Grab">
    <input type="reset" value="Reset" >
    </form>


    Hope that somebody can create a simple script/code for me to update to my website as this is not available in my website creator.

    Thanks in advance.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,869
    Thanks
    79
    Thanked 4,421 Times in 4,386 Posts
    This really is NOT a job for JavaScript. You need your page to send the user's request to the SERVER (that is, code written in PHP or ASP.NET or JSP) so that the database can be updated with the new user. Then the server will send back a *new* version of the same page, now showing that user in place.

    If you don't send the request to the server, then no changes made on the screen will be saved, so the entire effort would be a waste of time if you did this only in JavaScript.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •