I NEED HELP PLEASE [closed]

3

I AM LEARNING AND I DID THIS

<!DOCTYPE html>
<html>
  <head>
    <title>Tu peso en un lugar</title>
  </head>
  <body>
  <h1>tu peso en otro planeta</h1>
  <p>En la tierra pesas distinto que en jupiter y en marte</p>
  <scripttype=“text/javascript”>
    var usuario = prompt("Cual es tu peso");
    var planeta = parseInt(prompt("Elije tu planeta\n1 es marte, 2 es jupiter"));
    var peso = parseInt(usuario);
    var g_tierra = 9.8;
    var g_marte = 3.7;
    var g_jupiter = 24.8;
    var lugar;
    var peso_final;

    if (planeta == 1)
    {
     peso_final = peso * g_marte / g_tierra;
     lugar = "Marte";
    }
    else if (planeta == 2)
    {
     peso_final = peso * g_jupiter / g_tierra;
     lugar = "Jupiter";
     }
     else
     {
     peso_final = 100000;
     lugar = "kripton";
     }
    peso_final = parseInt(peso_final);
    document.write("Tu peso en " + lugar + "es <strong>" + peso_final + " kilos</strong>");
        </script>
      </body>
    </html>

I WANT TO LOAD IT IN THE CHROME BROWSER AND IT'S SENT ME

    
asked by Diego Lopez 29.11.2018 в 23:14
source

2 answers

0

If you go to line 9 of your document you will see that it reads:

<scripttype=“text/javascript”>

You are missing a space between script and type, like this:

<script type="text/javascript"> 

... and you should also change the quotation marks of that line, it seems that you copied and pasted them from the web and it took you a character that is not the normal double quotes, but some strange half quotes, I tried your code in my processor of texts and I noticed that error, remove those non-standard quotes and replace them with normal double quotes. Correcting those two things the script works correctly.

    
answered by 29.11.2018 в 23:30
0

The only problem you have is that you copied this part wrong, it is separated and you have to change the quotes to these "".

 <scripttype=“text/javascript”>

Goes like this:

 <script type="text/javascript">

With that it works perfect:

	<!DOCTYPE html>
	<html>
	  <head>
	    <title>Tu peso en un lugar</title>
	  </head>
	  <body>
	  <h1>tu peso en otro planeta</h1>
	  <p>En la tierra pesas distinto que en jupiter y en marte</p>
	  <script type="text/javascript">
	    var usuario = prompt("Cual es tu peso");
	    var planeta = parseInt(prompt("Elije tu planeta\n1 es marte, 2 es jupiter"));
	    var peso = parseInt(usuario);
	    var g_tierra = 9.8;
	    var g_marte = 3.7;
	    var g_jupiter = 24.8;
	    var lugar;
	    var peso_final;

	    if (planeta == 1)
	    {
	     peso_final = peso * g_marte / g_tierra;
	     lugar = "Marte";
	    }
	    else if (planeta == 2)
	    {
	     peso_final = peso * g_jupiter / g_tierra;
	     lugar = "Jupiter";
	     }
	     else
	     {
	     peso_final = 100000;
	     lugar = "kripton";
	     }
	    peso_final = parseInt(peso_final);
	    document.write("Tu peso en " + lugar + "es <strong>" + peso_final + " kilos</strong>");
	        </script>
	      </body>
	    </html>
    
answered by 29.11.2018 в 23:23