<body> <form action="test.js"> <p><b>Ваше имя:</b><br> <input type="text" name="u_name" size="35"> <p><b>Каким браузером вы пользуетесь?</b><br> <input type="radio" name="t" value="moz">mozilla<br> <input type="radio" name="t" value="chr">chrome<br> <input type="submit"> </p> </form> </body> 

This is the form itself.

 if(t==chr){ alert(u_name + ", you're using chome") } else{ alert(u_name + ", you're using mozilla") } 

This is the test.js file. Why does the page with the code come out on the site after sending the form and no action takes place?

  • And why should something else happen? - andreymal 5:41 pm
  • And how to make the code run? - Stepan Ivanov
  • four
    Put it in the <script> html tag, obviously. But even after that, it will not work, because you do not have the variables t and chr . Read javascript tutorials - andreymal 5:43 pm
  • And the <header> tag with meta tags does not seem to be there - Sergey Petrashko

0