• Post Reply Bookmark Topic Watch Topic
  • New Topic

JAVAscript and JSP

 
sandeep balyan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello To All
Iam Again with two problems...
1)Iam adding value of two textbox using javascript but the value
coming is ...
exm..
3+1.99=409888999999...like this
I want it to be accurate ..
so pls find some soln for this..
2)I want to use javascript for hidin gthe the location..or exact URL..pls let me know how can I..
bye and take care of U R Self
sandeep
 
Jolly Jumper
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandeep,
1.I don't know how's your code to sum up values from 2 text boxes.
But it's pretty simple and giving right result. See sample below.
<html>
<head>
<script>
function calculate(){
var frm = document.forms[0];
alert(parseFloat(frm.N1.value) + parseFloat(frm.N2.value));
}
</script>
</head>
<form>
<input name="N1">
<input name="N2">
<input type=button onClick="calculate()">
</form>
</html>
2. If you'd like to hide your location, donot use href attr of <a> tag. Use onClick event and a Javascript function instead.
Jolly.
 
sandeep balyan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for ans...
I want to ask if ..I use only
formname.text.value
instead of
document.formname.text.value

means putting (document) in front...
in javascript will it affect anyway
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!