Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Addition in html - Newbie question help plz !

HTML

  • Please log in to reply
2 replies to this topic

#1 xsystemx

xsystemx

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 16 September 2007 - 11:38 AM

[COLOR="Red"][B]Sidewinder | Please use [php], [code=auto:0] and
 tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [URL="http://forum.codecall.net/faq.php?faq=new_faq_item#faq_posting_rules"]The Forum Rules[/URL].[/B][/COLOR]

I am trying to write code that would allow me to have a list of products and it would be able to enter the amounts specified in boxes and give you the total once you press the total button....

I have pasted bellow what I have written so far... I am trying to figure out how to make it work... Please help me !

[highlight="HTML4Strict"]
<html>
<body>
<p>


Product 1<INPUT type="text" name="A" value=""
onChange="A.value">
Product 2<INPUT type="text" name="B" value=""
onChange="B.value">


<input type="submit" value="Total">   <input name="answer" type="text" size="4" maxlength="10"
onClick="document.calculator.ans.value+='A.value+B.value'">

</p>

</body>
</html>

  • 0

#2 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 17 September 2007 - 05:04 AM

You have no form name to start with:


<html>
<body>
<p>

<form name="Calculator">
Product 1<INPUT type="text" name="A" value=""
onChange="A.value">
Product 2<INPUT type="text" name="B" value=""
onChange="B.value">


<input type="submit" value="Total">   <input name="answer" type="text" size="4" maxlength="10"
onClick="document.Calculator.answer.value=eval(document.Calculator.A.value+document.Calculator.B.value)">

</form>

</p>

</body>
</html>



That should work although I didn't test it.
  • 0

#3 xsystemx

xsystemx

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 18 September 2007 - 08:33 AM

Can you test it and possibly post your findings? I was unable to make it work...

xsystemx
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download