2017-05-24 7 views
0

Random Character example私のウェブページの画像へのリンクです。 ページの下部にある>記号が生成される場所が見つかりません。私は、ランダムに1つのコードを検索するためにcmd fを使いましたが、どれも間違っているようです。それにもかかわらず、私は自分のコードを理解したい。Javascript/HTMLランダムな文字をページの下部に配置

また、なぜ私のforループがアクティブ化されていないのか分かりません。ただ、コードを扱うカード上記

<!DOCTYPE html> 
 
<html> 
 
    <head> 
 
    <meta charset="UTF-8"> 
 
    <title>The web site of matt9878</title> 
 
    <!-- The style.css file allows you to change the look of your web pages. 
 
     If you include the next line in all your web pages, they will all share the same look. 
 
     This makes it easier to make new pages for your site. --> 
 
    <link href="/style.css" rel="stylesheet" type="text/css" media="all"> 
 
    </head> 
 
    <body> 
 
    
 
    <div class="outputText"> 
 
     
 
     <!-- Equations assighment --> 
 
     <p id="equation"> Equation assighment: <br/></p> 
 
     
 
     <!-- Counting Coins assighment --> 
 
     <p id="combinations"> Coin combo assighment: <br/></p> 
 
     
 
     <!-- Timely Mesasurements assighment --> 
 
     <p id= "circumference"> Timely Mesasurements assighment: <br/></p> 
 
      
 
     <!-- Blackjack assighment --> 
 
     <p id="blackjackTotal"> Blackjack assighment: <br/></p> 
 
     
 
     <!-- Prime Time Assighment --> 
 
     <p id="primeTime"> Prime Time assighment: <br/></p> 
 
     
 
     
 
    </div> 
 
     
 
    <!-- Greetings assignment --> 
 
    <script> 
 
     window.alert("Hola, Como esta?"); 
 
    </script> 
 
    
 
    <!--Equations assighment--> 
 
    <script> 
 
     
 
     for(i = 0; i < 4; i++) 
 
     { 
 
     var x = Math.round(Math.random() * 1500); 
 
     var y = Math.round(Math.random() * 1500); 
 
     
 
     document.getElementById("equation").innerHTML += x + " + " + y + " = " + (x + y) + "<br/>"; 
 
     } 
 
     
 
     //*seriesOfEquations(); 
 
    </script> 
 
    
 
    <!-- Counting Coins assighment --> 
 
    <script> 
 
     var value = 175; 
 
     
 
     var penny = 1; 
 
     var nickel = 5; 
 
     var dime = 10; 
 
     var quarter = 25; 
 
     
 
     document.getElementById("combinations").innerHTML += (value/penny) + "(" + penny + ")" + " = " + value + "<br/>"; 
 
     document.getElementById("combinations").innerHTML += (value/nickel) + "(" + nickel + ")" + " = " + value + "<br/>"; 
 
     document.getElementById("combinations").innerHTML += Math.floor(value/dime) + "(" + dime + ")" + 
 
     " + " + nickel + " = " + value + "<br/>"; 
 
     document.getElementById("combinations").innerHTML += (value/quarter) + "(" + quarter + ")" + " = " + value + "<br/>"; 
 
     
 
    </script> 
 
    
 
    <!-- Timely Mesasurements assighment --> 
 
    <script> 
 
     var date = new Date(); 
 
     var rad = date.getHours(); 
 
     
 
     document.getElementById("circumference").innerHTML += (2 * Math.PI * rad).toFixed(3) + "<br/>"; 
 
    </script> 
 
    
 
    <!-- Blackjack assighment -->> 
 
    <script> 
 
     //Card dealing 
 
     var cardOne = (Math.ceil(Math.random() * 10) + 1); 
 
     var cardTwo = (Math.ceil(Math.random() * 10) + 1); 
 
     var combined = cardOne + cardTwo; 
 
     
 
     var cardValues = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; 
 
     
 
     //Ace checking 
 
     if (cardOne == 11 && combined > 21) { 
 
     cardOne = 1; 
 
     combined = cardOne + cardTwo; 
 
     } 
 
     else if (cardTwo == 11 && combined > 21) { 
 
     cardTwo = 1; 
 
     combined = cardOne + cardTwo; 
 
     } 
 
    
 
     //Dealer hit sequence 
 
     if (combined < 17) { 
 
     
 
     document.getElementById("blackjackTotal").innerHTML += "The dealer is hitting thier current total of " + combined + "<br/>"; 
 
     
 
     cardOne = (Math.ceil(Math.random() * 10) + 1); 
 
     
 
     //Ace checking 
 
     if (cardOne == 11 && (combined + cardOne) > 21) { 
 
      cardOne = 1; 
 
      combined = combined + cardOne; 
 
     } 
 
     else { 
 
      combined = combined + cardOne; 
 
     } 
 
     } 
 
    
 
     //Blackjack 
 
     if (combined == 21) {  
 
     document.getElementById("blackjackTotal").innerHTML += "Blackjack!!!!" + "<br/>"; 
 
     } 
 
     
 
     //Dealer bust 
 
     else if (combined > 21) { 
 
     document.getElementById("blackjackTotal").innerHTML += "The dealer has gone bust with a total of " + combined + "." + "<br/>"; 
 
     } 
 
     
 
     //Dealer total ancouncement 
 
     else{ 
 
     document.getElementById("blackjackTotal").innerHTML += "The dealer's total is " + combined + "." + "<br/>"; 
 
     } 
 
     
 
    </script> 
 
    
 
    <!-- Prime time assighment --> 
 
    <script> 
 
     var numOne = Number(prompt("Please enter the first whole number to begin the range you'd like to explore.")); 
 
     var numTwo = Number(prompt("Enter the second whole number to conclude the range you'd like to explore. Hint: Second choice > first.")); 
 
     
 
     window.alert(numOne + ", " + numTwo); 
 
     
 
     if (numOne < numTwo && (numOne.isInteger() && numTwo.isInteger())) { 
 
     for(; numOne <= numTwo; numOne++) { 
 
      document.getElementById("primeTime").innerHTML += numOne + ", " + numTwo + "<br/>"; 
 
     }   
 
     } 
 
     else { 
 
     window.alert("Please reload the webpage and try again. Error code: User error."); 
 
     } 
 
    </script> 
 
    
 
    </body> 
 
</html>

+0

エラーは再現できません。添付の画像に示されているエラーを再現するソースコードを共有してください。 –

+0

@ A.J。すべての警告をキャンセルしてみてください。再現することができます。 'Prime Time assighment:' – Swellar

+1

あなたのコードで '' 'を検索します。ビンゴ。 –

答えて

0

を助けることを願っています:

固定

>

として実行

<!-- Blackjack assighment -->> 

<!DOCTYPE html> 
 
<html> 
 
    <head> 
 
    <meta charset="UTF-8"> 
 
    <title>The web site of matt9878</title> 
 
    <!-- The style.css file allows you to change the look of your web pages. 
 
     If you include the next line in all your web pages, they will all share the same look. 
 
     This makes it easier to make new pages for your site. --> 
 
    <link href="/style.css" rel="stylesheet" type="text/css" media="all"> 
 
    </head> 
 
    <body> 
 
    
 
    <div class="outputText"> 
 
     
 
     <!-- Equations assighment --> 
 
     <p id="equation"> Equation assighment: <br/></p> 
 
     
 
     <!-- Counting Coins assighment --> 
 
     <p id="combinations"> Coin combo assighment: <br/></p> 
 
     
 
     <!-- Timely Mesasurements assighment --> 
 
     <p id= "circumference"> Timely Mesasurements assighment: <br/></p> 
 
      
 
     <!-- Blackjack assighment --> 
 
     <p id="blackjackTotal"> Blackjack assighment: <br/></p> 
 
     
 
     <!-- Prime Time Assighment --> 
 
     <p id="primeTime"> Prime Time assighment: <br/></p> 
 
     
 
     
 
    </div> 
 
     
 
    <!-- Greetings assignment --> 
 
    <script> 
 
     window.alert("Hola, Como esta?"); 
 
    </script> 
 
    
 
    <!--Equations assighment--> 
 
    <script> 
 
     
 
     for(i = 0; i < 4; i++) 
 
     { 
 
     var x = Math.round(Math.random() * 1500); 
 
     var y = Math.round(Math.random() * 1500); 
 
     
 
     document.getElementById("equation").innerHTML += x + " + " + y + " = " + (x + y) + "<br/>"; 
 
     } 
 
     
 
     //*seriesOfEquations(); 
 
    </script> 
 
    
 
    <!-- Counting Coins assighment --> 
 
    <script> 
 
     var value = 175; 
 
     
 
     var penny = 1; 
 
     var nickel = 5; 
 
     var dime = 10; 
 
     var quarter = 25; 
 
     
 
     document.getElementById("combinations").innerHTML += (value/penny) + "(" + penny + ")" + " = " + value + "<br/>"; 
 
     document.getElementById("combinations").innerHTML += (value/nickel) + "(" + nickel + ")" + " = " + value + "<br/>"; 
 
     document.getElementById("combinations").innerHTML += Math.floor(value/dime) + "(" + dime + ")" + 
 
     " + " + nickel + " = " + value + "<br/>"; 
 
     document.getElementById("combinations").innerHTML += (value/quarter) + "(" + quarter + ")" + " = " + value + "<br/>"; 
 
     
 
    </script> 
 
    
 
    <!-- Timely Mesasurements assighment --> 
 
    <script> 
 
     var date = new Date(); 
 
     var rad = date.getHours(); 
 
     
 
     document.getElementById("circumference").innerHTML += (2 * Math.PI * rad).toFixed(3) + "<br/>"; 
 
    </script> 
 
    
 
    <!-- Blackjack assighment --> 
 
    <script> 
 
     //Card dealing 
 
     var cardOne = (Math.ceil(Math.random() * 10) + 1); 
 
     var cardTwo = (Math.ceil(Math.random() * 10) + 1); 
 
     var combined = cardOne + cardTwo; 
 
     
 
     var cardValues = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; 
 
     
 
     //Ace checking 
 
     if (cardOne == 11 && combined > 21) { 
 
     cardOne = 1; 
 
     combined = cardOne + cardTwo; 
 
     } 
 
     else if (cardTwo == 11 && combined > 21) { 
 
     cardTwo = 1; 
 
     combined = cardOne + cardTwo; 
 
     } 
 
    
 
     //Dealer hit sequence 
 
     if (combined < 17) { 
 
     
 
     document.getElementById("blackjackTotal").innerHTML += "The dealer is hitting thier current total of " + combined + "<br/>"; 
 
     
 
     cardOne = (Math.ceil(Math.random() * 10) + 1); 
 
     
 
     //Ace checking 
 
     if (cardOne == 11 && (combined + cardOne) > 21) { 
 
      cardOne = 1; 
 
      combined = combined + cardOne; 
 
     } 
 
     else { 
 
      combined = combined + cardOne; 
 
     } 
 
     } 
 
    
 
     //Blackjack 
 
     if (combined == 21) {  
 
     document.getElementById("blackjackTotal").innerHTML += "Blackjack!!!!" + "<br/>"; 
 
     } 
 
     
 
     //Dealer bust 
 
     else if (combined > 21) { 
 
     document.getElementById("blackjackTotal").innerHTML += "The dealer has gone bust with a total of " + combined + "." + "<br/>"; 
 
     } 
 
     
 
     //Dealer total ancouncement 
 
     else{ 
 
     document.getElementById("blackjackTotal").innerHTML += "The dealer's total is " + combined + "." + "<br/>"; 
 
     } 
 
     
 
    </script> 
 
    
 
    <!-- Prime time assighment --> 
 
    <script> 
 
     var numOne = Number(prompt("Please enter the first whole number to begin the range you'd like to explore.")); 
 
     var numTwo = Number(prompt("Enter the second whole number to conclude the range you'd like to explore. Hint: Second choice > first.")); 
 
     
 
     window.alert(numOne + ", " + numTwo); 
 
     
 
     if (numOne < numTwo && (numOne.isInteger() && numTwo.isInteger())) { 
 
     for(; numOne <= numTwo; numOne++) { 
 
      document.getElementById("primeTime").innerHTML += numOne + ", " + numTwo + "<br/>"; 
 
     }   
 
     } 
 
     else { 
 
     window.alert("Please reload the webpage and try again. Error code: User error."); 
 
     } 
 
    </script> 
 
    
 
    </body> 
 
</html>

+0

ありがとう。私は>>を検索していたはずです。次回はそのことを覚えておきます。 – Matt9878

0

、余分な '>' はコメントブラックジャックの割り当てでもあります。余分な>コメントにあった、それはライン77で

+0

ありがとうございます。ダムの間違い.... – Matt9878

関連する問題