Web Analytics Made Easy -
StatCounter Help with Coding a Fantasy Draft - CodingForum

Announcement

Collapse
No announcement yet.

Help with Coding a Fantasy Draft

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with Coding a Fantasy Draft

    So I am trying to code a fantasy draft for a wrestling game. I want to be able to click an image of a superstar and have his/her name show up in the team's draft list. Could anyone help me out with this please? No clue what i'm doing but here is what i have. It's definitely not a good start though lol

    <!DOCTYPE html>
    <html>
    <body>

    <img src="C:\Users\Dan\Desktop\WWE 2K\AustinAries.jpg"/>



    Field1: <input type="text" id="field1" value="text"><br>
    Field2: <input type="text" id="field2"><br><br>

    <button onclick="myFunction()">Copy Text</button>

    <p>A function is triggered when the button is clicked. The function copies the text from Field1 into Field2.</p>

    <script>
    function myFunction() {
    document.getElementById("field2").value = document.getElementById("field1").value;
    }

    </script>

    </body>
    </html>

  • #2
    Quick with very little style:
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <title>Wrestler Picks</title>
    <style type="text/css">
    .pics{
    	width: 200px;
    	height: 230px;
    	text-align: center;
    	margin-right: 20px;
    	float: left;
    	border: 1px solid black;
    }
    </style>
    </head>
    
    <body>
    <div class="pics" onclick="myFunction('Austin Aries');">
    <img src="austinaries.jpg" width="200" height="200">
    Austin Aries
    </div>
    <div class="pics" onclick="myFunction('Hulk Hogan');">
    <img src="hulkhogan.jpg" width="200" height="200">
    Hulk Hogan
    </div>
    <br style="clear:both;">
    <br>
    Field1: <input type="text" id="field1" value="text"><br>
    Field2: <input type="text" id="field2"><br><br>
    
    <script>
    numb = 1;
    function myFunction(tex) {
    	document.getElementById("field"+numb).value = tex;
    	numb++;
    }
    </script>
    </body>
    </html>
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.

    Comment


    • #3
      wow thank you so much!

      Comment


      • #4
        Please note that the method I used, with "numb", means the pick chart MUST be filled out at one setting. I don't know how you are saving this PHP and MySQLi I hope, It can be easily modified to work with this structure.
        Evolution - The non-random survival of random variants.
        Physics is actually atoms trying to understand themselves.

        Comment


        • #5
          Ok so that code didn't end up working out in the long run. But this is what I want to try to do.

          The Official Site of the WWE Universe | www.wwe.com

          only instead of it bringing up one picture, i want all the superstars to be shown and you pick which one goes to either RAW or Smackdown.

          Is there any way to do this?

          Comment


          • #6
            And if possible, allow people to save their draft like on that website.

            Comment


            • #7
              This is what i have going so far


              <!DOCTYPE html>
              <html>
              <head>
              <style>
              table, th, td {
              border: 1px solid black;
              }
              </style>
              </head>
              <body>
              <table id="RawTable" width="33%" style="border: 2px solid black; float:left; display: inline-block;" ondrop="drop(event)" ondragover="allowDrop(event)">
              <tr>
              <th> RAW </th>
              </tr>
              <tr>
              <td id="raw" ondrop="drop(event)" ondragover="allowDrop(event)"> </td>
              </tr>
              </table>

              <table id="Wrestlers" width="33%" style="border: 2px solid black; float:center; display: inline-block;">
              <tr draggable="true" ondragstart="drag(event)">
              <td> <img height="100" width = "70" src="http://blogs-images.forbes.com/brianmazique/files/2016/08/Cp_K_kBVUAAaOvC1.jpg"></img> </td>
              <tr>
              <td><button onclick="add2Raw(wrestlers[0], 1)"> RAW </button></td>
              <td><button onclick="add2SD(wrestlers[0], 2)"> SmackDown </button></td>
              <tr>
              </tr>
              <tr>
              <td> Alberto Del Rio </td>
              <tr>
              <td><button onclick="add2Raw(wrestlers[1], 1)"> RAW </button></td>
              <td><button onclick="add2SD(wrestlers[1], 2)"> SmackDown </button></td>
              <tr>
              </tr>
              <tr>
              <td> Apollo Crews </td>
              <tr>
              <td><button onclick="add2Raw(wrestlers[2], 1)"> RAW </button></td>
              <td><button onclick="add2SD(wrestlers[2], 2)"> SmackDown </button></td>
              <tr>
              </tr>
              <tr>
              <td> Austin Aries </td>
              <tr>
              <td><button onclick="add2Raw(wrestlers[3], 1)"> RAW </button></td>
              <td><button onclick="add2SD(wrestlers[3], 2)"> SmackDown </button></td>
              <tr>
              </tr>
              <tr>
              <td> baron corbin </td>
              <tr>
              <td><button onclick="add2Raw(wrestlers[4], 1)"> RAW </button></td>
              <td><button onclick="add2SD(wrestlers[4], 2)"> SmackDown </button></td>
              <tr>
              </tr>
              <tr>
              <td> big show </td>
              <tr>
              <td><button onclick="add2Raw(wrestlers[5], 1)"> RAW </button></td>
              <td><button onclick="add2SD(wrestlers[5], 2)"> SmackDown </button></td>
              <tr>
              </tr>
              <table id="SDTable" width="33%" style="border: 2px solid black; float:right; display: inline-block;">
              <tr>
              <th> SMACKDOWN </th>
              </tr>
              <tr>
              <td id="SD"> </td>
              </tr>
              </table>
              </div>

              <script>
              function allowDrop(ev) {
              v.preventDefault();
              }

              function drag(ev) {
              ev.dataTransfer.setData("text", ev.target.id);
              }

              function drop(ev) {
              ev.preventDefault();
              var data = ev.dataTransfer.getData("text");
              ev.target.appendChild(document.getElementById(data));
              }
              function addWrestler(p1, p2) {
              if (p2 == 1)
              { RAW[Rcnt] = p1; Rcnt++}
              if (p2 == 2)
              { SmackDown[Scnt] = p1; Scnt++}
              document.getElementById("raw").innerHTML = RAW;
              document.getElementById("SD").innerHTML = SmackDown;

              }
              function add2Raw(p1, p2) {
              var table = document.getElementById("RawTable");
              var row = table.insertRow(1);
              var cell1 = row.insertCell(0);
              cell1.innerHTML = p1;
              }

              function add2SD(p1, p2) {
              var table = document.getElementById("SDTable");
              var row = table.insertRow(1);
              var cell1 = row.insertCell(0);
              cell1.innerHTML = p1;
              }

              var wrestlers = ["AJ Styles", "Alberto Del Rio", "Apollo Crews", "Austin Aries", "baron corbin", "big show", "bo dallas", "braun strowman", "bray wyatt", "brock lesnar", "cesaro", "chris jericho", "curtis axel", "daniel bryan", "darren young", "dean ambrose", "dolph ziggler", "finn balor", "heath slater", "hideo itami", "jack swagger", "john cena", "kalisto", "kane", "kevin owens", "mark henry", "neville", "randy orton", "roman reigns", "rusev", "sami zayn", "samoa joe", "seth rollins", "sheamus", "shinsuke nakamura", "sin cara", "stardust ", "the miz", "titus oneil", "tye dillinger", "tyson kidd", "vaudevillains", "cass & enzo", "new day", "new age outlaws", "dudley boys", "blake & murphy", "american alpha", "the revival", "shining stars", "wyatts", "breezango", "golden truth", "usos", "the club", "hype bros", "ascension", "alexa bliss", "alicia fox", "asuka", "bayley", "becky", "brie bella", "carmella", "charlotte", "dana brooke", "emma", "eva marie", "naomi", "natalya", "nia jax", "nikki bella", "paige", "sasha banks", "stephanie mcmahon", "summer rae", "tamina", "trish stratus", "lita", "jacqueline", "ivory", "booker t", "bret hart", "cactus jack", "christian", "ddp", "diesel", "eddie guerrero", "edge", "goldberg", "jbl", "razor ramon", "ric flair", "rikishi", "shane mcmahon", "shawn michaels", "stone cold", "sting", "the rock", "triple h", "the undertaker"]
              var RAW = ["No one is on this show yet."];

              var SmackDown = ["No one is on this show yet."];
              var Rcnt = 0;
              var Scnt = 0;
              document.getElementById("draft").innerHTML = wrestlers;
              document.getElementById("raw").innerHTML = RAW;
              document.getElementById("SD").innerHTML = SmackDown;

              </script>
              </body>
              </html>

              Comment


              • #8
                Originally posted by DRest608 View Post
                Ok so that code didn't end up working out in the long run.
                Why??? And why can't you modify it to do what you want now? The mod looks easy to me.

                only instead of it bringing up one picture, i want all the superstars to be shown
                Are you saying you can't do that?

                Please use [code] tags to display your code. Makes it easy to copy/paste.


                What you have looks good. Don't use inline styling.

                This is not a free coding service. We help you with your code when your up ma tree. If you want someone to code this for you I'd be happy to use your code and give you a working page for a price. PM me if interested.
                Evolution - The non-random survival of random variants.
                Physics is actually atoms trying to understand themselves.

                Comment


                • #9
                  wow take it easy bro. Just asking for a little bit of help. Have some common decency and don't be a dick. I know this isn't a free coding service but there are some people willing to help out. If your not willing to help don't RESPOND! easy as that. There are such scumbags in this world and you are one of them my friend. go **** yourself

                  Comment


                  • #10
                    What did I write that pulled your trigger? What made you so upset? I'd like to know. What was it?
                    Evolution - The non-random survival of random variants.
                    Physics is actually atoms trying to understand themselves.

                    Comment

                    Working...
                    X