<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1018346" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1018346</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/another-java-question-i-think#comment-1108113</link>
    <description> &lt;p&gt;sorry was off for a week.&lt;/p&gt;
&lt;p&gt;	Discount Test&lt;br /&gt;
&amp;lt;script language=&quot;JavaScript&quot;&amp;gt;&lt;br /&gt;
function do_discount()&lt;br /&gt;
{&lt;/p&gt;
&lt;p&gt;	var total_ordered=document.get_data.number_ordered.value;&lt;br /&gt;
	var total_cost=document.get_data.number_ordered.value*document.get_data.cost.value&lt;/p&gt;
&lt;p&gt;	if(total_ordered&amp;gt;=0 &amp;amp;&amp;amp; total_ordered &amp;gt;24)&lt;br /&gt;
	{&lt;br /&gt;
		total_cost=total_cost-(5000*document.get_data.number_ordered.value);&lt;br /&gt;
	}&lt;br /&gt;
	if(total_ordered&amp;gt;=24 &amp;amp;&amp;amp; total_ordered &amp;gt;48)&lt;br /&gt;
	{&lt;br /&gt;
		total_cost=total_cost-(1000*document.get_data.number_ordered.value);&lt;br /&gt;
	}&lt;br /&gt;
	else if(total_ordered&amp;gt;=48 &amp;amp;&amp;amp; total_ordered &amp;gt;72)&lt;br /&gt;
	{&lt;br /&gt;
		total_cost=total_cost-(15000*document.get_data.number_ordered.value);&lt;br /&gt;
	}&lt;br /&gt;
	document.get_data.answer.value=total_cost;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;p&gt;	Number:&lt;/p&gt;
&lt;p&gt;    Row ABC&lt;/p&gt;
&lt;p&gt;The figure still don&#039;t come out right.&lt;/p&gt;
 </description>
     <pubDate>Thu, 02 May 2002 18:34:41 +0000</pubDate>
 <dc:creator>Warlord Khan</dc:creator>
 <guid isPermaLink="false">comment 1108113 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/another-java-question-i-think#comment-1107703</link>
    <description> &lt;p&gt;In if statements multiply the discount by the number ordered, for example:&lt;/p&gt;
&lt;p&gt;total_cost=total_cost-(5000*document.get_data.number_ordered.value); &lt;/p&gt;
&lt;p&gt;Also delete document.get_data.answer.value=total_cost; from the top and add document.get_data.answer.value=total_cost just before the closing brace.&lt;/p&gt;
 </description>
     <pubDate>Thu, 25 Apr 2002 16:53:00 +0000</pubDate>
 <dc:creator>doublehelix</dc:creator>
 <guid isPermaLink="false">comment 1107703 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/another-java-question-i-think#comment-1107702</link>
    <description> &lt;p&gt;Discount Test&lt;br /&gt;
&amp;lt;script language=&quot;JavaScript&quot;&amp;gt;&lt;br /&gt;
function do_discount()&lt;br /&gt;
{&lt;/p&gt;
&lt;p&gt;	var total_ordered=document.get_data.number_ordered.value;&lt;br /&gt;
	var total_cost=document.get_data.number_ordered.value*document.get_data.cost.value&lt;br /&gt;
	document.get_data.answer.value=total_cost;&lt;/p&gt;
&lt;p&gt;	if(total_ordered&amp;gt;=0 &amp;amp;&amp;amp; total_ordered &amp;lt;24)&lt;br /&gt;
	{&lt;br /&gt;
		total_cost=total_cost-5000;&lt;br /&gt;
	}&lt;br /&gt;
	if(total_ordered&amp;gt;=24 &amp;amp;&amp;amp; total_ordered &amp;lt;48)&lt;br /&gt;
	{&lt;br /&gt;
		total_cost=total_cost-10000;&lt;br /&gt;
	}&lt;br /&gt;
	else if(total_ordered&amp;gt;=48 &amp;amp;&amp;amp; total_ordered &amp;lt;72)&lt;br /&gt;
	{&lt;br /&gt;
		total_cost=total_cost-15000;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;p&gt;	Number:&lt;/p&gt;
&lt;p&gt;    Row ABC&lt;/p&gt;
&lt;p&gt;That&#039;s the HTMl code of my test page but it doesn&#039;t seem to take the discount off. Example:&lt;/p&gt;
&lt;p&gt;Enter a quantity of 24 and you should get 13080000, where in reality it should be 12960000&lt;/p&gt;
 </description>
     <pubDate>Thu, 25 Apr 2002 16:25:03 +0000</pubDate>
 <dc:creator>Warlord Khan</dc:creator>
 <guid isPermaLink="false">comment 1107702 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/another-java-question-i-think#comment-1107698</link>
    <description> &lt;p&gt;Oh, you are new to javascript. Well, you&#039;ve certainly picked an ambitious beginning project.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Short Answer:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For starters, add another row to the form and give the text element in it a unique name -- say answer. Then, after you&#039;ve calculated the discount assign it to that text element like this:&lt;/p&gt;
&lt;p&gt;document.get_data.answer.value=total_cost;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Longer Answer:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If you&#039;re going to start messing with JavaScript you&#039;re going to have to figure out the dot syntax used to path through browser objects. Fortunately, without you realizing it, knowledge of HTML has already prepared you for that. Consider the nesting of the &quot;cost&quot; input box in the HTML:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;form name=get_data&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;input element name=cost&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;That input element has an attribute (confusing enough, called a property in Object Oriented lingo) called value. Anything assigned to that value property will appear in the text box called &quot;cost.&quot;&lt;/p&gt;
&lt;p&gt;Above was the nesting scheme for it in HTML, to get to it in JavaScript you need to use the dot syntax, which is just another way of showing that nexting scheme. BTW, the body is called the document in JS. So to get to the value property we type:&lt;/p&gt;
&lt;p&gt;document.get_data.cost.value&lt;/p&gt;
&lt;p&gt;Trace through the relevant HTML nesting and you&#039;ll see that JS paths the same, they just use a different syntax to do it.&lt;/p&gt;
 </description>
     <pubDate>Thu, 25 Apr 2002 14:02:33 +0000</pubDate>
 <dc:creator>doublehelix</dc:creator>
 <guid isPermaLink="false">comment 1107698 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/another-java-question-i-think#comment-1107652</link>
    <description> &lt;p&gt;&#039;m afraid I must again ask, how?&lt;/p&gt;
&lt;p&gt;I&#039;ve got the text box in but how do I change the code to make it display there?&lt;/p&gt;
 </description>
     <pubDate>Wed, 24 Apr 2002 20:33:35 +0000</pubDate>
 <dc:creator>Warlord Khan</dc:creator>
 <guid isPermaLink="false">comment 1107652 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/another-java-question-i-think#comment-1107651</link>
    <description> &lt;p&gt;Sure, i just use alertboxes to keep track of values when i write scripts. Just add another form element to the form... the textbox you want the answer displayed in, and when you calculate the discounted price assign it to that text box.&lt;/p&gt;
 </description>
     <pubDate>Wed, 24 Apr 2002 19:41:28 +0000</pubDate>
 <dc:creator>doublehelix</dc:creator>
 <guid isPermaLink="false">comment 1107651 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/another-java-question-i-think#comment-1107650</link>
    <description> &lt;p&gt;is it possible to do it without the popup boxes? like just have it appear in another text box?&lt;/p&gt;
 </description>
     <pubDate>Wed, 24 Apr 2002 19:26:01 +0000</pubDate>
 <dc:creator>Warlord Khan</dc:creator>
 <guid isPermaLink="false">comment 1107650 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/another-java-question-i-think#comment-1107648</link>
    <description> &lt;p&gt;Forget the switch statement. Below is a test web page including the html and the form:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;!DOCTYPE HTML PUBLIC &amp;quot;-//W3C//DTD HTML 4.0 Transitional//EN&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;	&amp;lt;title&amp;gt;Discount Test&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;function do_discount()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;	var total_ordered=document.get_data.number_ordered.value;&lt;br /&gt;	var total_cost=document.get_data.number_ordered.value*document.get_data.cost.value&lt;br /&gt;&lt;br /&gt;	alert(&amp;quot;non-discounted: &amp;quot;+total_cost);&lt;br /&gt;	&lt;br /&gt;	if(total_ordered&amp;gt;=24 &amp;amp;&amp;amp; total_ordered &amp;lt;48)&lt;br /&gt;	{&lt;br /&gt;		total_cost=total_cost-5000;&amp;nbsp; &lt;br /&gt;	}&lt;br /&gt;	else if(total_ordered&amp;gt;=48 &amp;amp;&amp;amp; total_ordered&amp;lt;72)&lt;br /&gt;	{ &lt;br /&gt;		total_cost=total_cost-10000; &lt;br /&gt;	}&lt;br /&gt;	else if(total_ordered&amp;gt;=72)&lt;br /&gt;	{ &lt;br /&gt;			total_cost=total_cost-15000; &lt;br /&gt;	} &lt;br /&gt;&lt;br /&gt;	alert(&amp;quot;discounted: &amp;quot;+total_cost);&lt;br /&gt;} &lt;br /&gt;&amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;form action=&amp;quot;&amp;quot; name=&amp;quot;get_data&amp;quot; id=&amp;quot;get_data&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;table width=500 cellspacing=4 border=0&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;	&amp;lt;td valign=&amp;quot;top&amp;quot; align=&amp;quot;right&amp;quot;&amp;gt;&lt;br /&gt;	Cost:&lt;br /&gt;	&amp;lt;/td&amp;gt;&lt;br /&gt;	&amp;lt;td valign=&amp;quot;top&amp;quot; align=&amp;quot;left&amp;quot;&amp;gt;&lt;br /&gt;	&amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;cost&amp;quot;&amp;gt;&lt;br /&gt;	&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;	&amp;lt;td valign=&amp;quot;top&amp;quot; align=&amp;quot;right&amp;quot;&amp;gt;&lt;br /&gt;	Number:&lt;br /&gt;	&amp;lt;/td&amp;gt;&lt;br /&gt;	&amp;lt;td valign=&amp;quot;top&amp;quot; align=&amp;quot;left&amp;quot;&amp;gt;&lt;br /&gt;	&amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;number_ordered&amp;quot;&amp;gt;&lt;br /&gt;	&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;	&amp;lt;td valign=&amp;quot;top&amp;quot; align=&amp;quot;right&amp;quot;&amp;gt;&lt;br /&gt;	&amp;amp;nbsp;&lt;br /&gt;	&amp;lt;/td&amp;gt;&lt;br /&gt;	&amp;lt;td valign=&amp;quot;top&amp;quot; align=&amp;quot;left&amp;quot;&amp;gt;&lt;br /&gt;	&amp;lt;input type=&amp;quot;button&amp;quot; value=&amp;quot;submit&amp;quot; onClick=&amp;quot;do_discount()&amp;quot;&amp;gt;&lt;br /&gt;	&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Wed, 24 Apr 2002 18:27:18 +0000</pubDate>
 <dc:creator>doublehelix</dc:creator>
 <guid isPermaLink="false">comment 1107648 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/another-java-question-i-think#comment-1107647</link>
    <description> &lt;p&gt;...&lt;/p&gt;
 </description>
     <pubDate>Wed, 24 Apr 2002 18:02:59 +0000</pubDate>
 <dc:creator>doublehelix</dc:creator>
 <guid isPermaLink="false">comment 1107647 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/another-java-question-i-think#comment-1107641</link>
    <description> &lt;p&gt;I aint too good at JavaScript so I would have absolutley no idea how to intergrate that into a page...could you do me an example please?&lt;/p&gt;
 </description>
     <pubDate>Wed, 24 Apr 2002 16:18:42 +0000</pubDate>
 <dc:creator>Warlord Khan</dc:creator>
 <guid isPermaLink="false">comment 1107641 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
