hi~ i am a beginner of using Javascript.I am doing a project.
The project needs:
1.creat a textbox to let the user input their mark.
2.creat a second textbox and a button
3.after enter a mark in the first box and click the button,the second textbox show the grade
That is...However,i wrote my code,but it doesnt work(no boxes show up)...can anyone help me?Thank you!

<html><head><title>grade</title></head>
<body>
<script language ="javaScript">
<form>
<input type=text value='' name=n1></input>
<input type=text value=n1 name=n2></input>
if (mark>=90){
	letterGrade="A";
}
else if(mark>=80){
	letterGrade="B";
}
else if(mark>=70){
	letterGrade="C";
}
else if (mark>=50 ){
letterGrade ="D";
}
else {
	letterGrade="F";
}
document.write("Marks"+ mark+ "get letter grade "+letterGrade);}
</form>
</script></body></html>

Edited 5 Years Ago by canyvr: n/a

I have a few remarks here ..
firstly, you're mistaking javascript for java, which is a completely other language.
secondly, you're trying to write standard html within script tags, which won't work for obvious reasons, since it isn't javascript code.

you also never declare the variables which you are using.

<html><head><title>grade</title>
<script type="text/javascript">
 //write all your javaSCRIPT code here
 // do remember, this is not java though
</script>
</head>
      <body>
<!--
  write the contents of your html page here
  if you want to write additional javascript here, that is not triggered by, for instance, clicking on a button, you'll need to repeat the javascript tags
-->    
</body></html>

this should get you started, but this might be a thread to start within the web-development forum :)

Ya,i found out the miskate,and also thank you to tell the Java and Javascript are different.Thanks a lot!

I have a few remarks here ..
firstly, you're mistaking javascript for java, which is a completely other language.
secondly, you're trying to write standard html within script tags, which won't work for obvious reasons, since it isn't javascript code.

you also never declare the variables which you are using.

<html><head><title>grade</title>
<script type="text/javascript">
 //write all your javaSCRIPT code here
 // do remember, this is not java though
</script>
</head>
      <body>
<!--
  write the contents of your html page here
  if you want to write additional javascript here, that is not triggered by, for instance, clicking on a button, you'll need to repeat the javascript tags
-->    
</body></html>

this should get you started, but this might be a thread to start within the web-development forum :)

This article has been dead for over six months. Start a new discussion instead.