<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1042009" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1042009</link>
    <description></description>
    <language>en</language>
          <item>
    <title>Yeah, after I wrote it I</title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/javascript-multiplying-numbers-live-page#comment-1233953</link>
    <description> &lt;p&gt;Yeah, after I wrote it I noticed the line breaks would be gone, but the script should provide a basis for what to do and how to handle the data...&lt;/p&gt;
&lt;p&gt;I even wondered if the typeof function would recognize the numbers as numbers since they are pulled from a string.  I&#039;m not completely sure of how the split function handles data and how the array stores it all...&lt;/p&gt;
 </description>
     <pubDate>Sat, 27 Sep 2008 17:40:30 +0000</pubDate>
 <dc:creator>mscreashuns</dc:creator>
 <guid isPermaLink="false">comment 1233953 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>MS&#039;s script should multiply</title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/javascript-multiplying-numbers-live-page#comment-1233951</link>
    <description> &lt;p&gt;MS&#039;s script should multiply the numbers, but I think it will lose the line breaks?&lt;/p&gt;
&lt;p&gt;This sounds like a good place to use getelementsbyclassname...&lt;/p&gt;
&lt;p&gt;However, that method is not yet supported by IE... so you can use a custom function&lt;/p&gt;
&lt;p&gt;check here&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.google.com/search?&amp;amp;q=getelementsbyclassname&quot; title=&quot;http://www.google.com/search?&amp;amp;q=getelementsbyclassname&quot;&gt;http://www.google.com/search?&amp;amp;q=getelementsbyclassname&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Sat, 27 Sep 2008 17:11:58 +0000</pubDate>
 <dc:creator>decibel.places</dc:creator>
 <guid isPermaLink="false">comment 1233951 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>The problem is that I don&#039;t</title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/javascript-multiplying-numbers-live-page#comment-1233950</link>
    <description> &lt;p&gt;The problem is that I don&#039;t know how your recipe &quot;inputting&quot; is set up, but if you are sure that every number within this certain text needs to be multiplied, you could do the following assuming that everything is within one DIV or similar element.&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;script...&amp;gt;&lt;br /&gt;function newRecipe(numServings) {&lt;br /&gt;	 var allWords = document.getElementById(&amp;quot;recipe&amp;quot;).split(&amp;quot; &amp;quot;);&lt;br /&gt;	 var newRecipe = &amp;quot;&amp;quot;;&lt;br /&gt;	 for (i=0; i&amp;lt;allWorlds.length; i++) {&lt;br /&gt;	 	 if (typeof(allWords[i]) == &amp;quot;number&amp;quot;) {&lt;br /&gt;	 	 	 allWords[i] *= numServings;&lt;br /&gt;	 	 }&lt;br /&gt;	 	 newRecipe = allWords[i]+&amp;quot; &amp;quot;;&lt;br /&gt;	 }&lt;br /&gt;	 document.getElementById(&amp;quot;recipe&amp;quot;).innerHTML = newRecipe;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;div id=&amp;quot;recipe&amp;quot;&amp;gt;&lt;br /&gt;222 g wheat&lt;br /&gt;222 g rye flour&lt;br /&gt;288 mL water&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;form name=&amp;quot;getRecipe&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;text&amp;quot; id=&amp;quot;numServings&amp;quot; onchange=&amp;quot;newRecipe(this.value)&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;...&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;I still don&#039;t know if this is efficient as I didn&#039;t even actually test it, but something along these lines would pull all of the text out of the DIV &quot;recipe&quot; and multiply all numbers by the &quot;numServings&quot; value.&lt;/p&gt;
 </description>
     <pubDate>Sat, 27 Sep 2008 15:48:28 +0000</pubDate>
 <dc:creator>mscreashuns</dc:creator>
 <guid isPermaLink="false">comment 1233950 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Wow that&#039;s very insightful</title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/javascript-multiplying-numbers-live-page#comment-1233948</link>
    <description> &lt;p&gt;Wow that&#039;s very insightful mscreashuns, thanks. I see what you&#039;re doing there, but the problem is that I wouldn&#039;t be able to create variables for every recipe. And I&#039;m not quite sure why I&#039;d need to worry about creating variables for the measurements? Essentially I&#039;ve got just the numbers on a page to work with. Is there a way to find these numbers (say those in a particular div) and multiply them in javascript, presenting them temporarily changed on a page?&lt;/p&gt;
&lt;p&gt;Now the more I look at it, the odder the idea seems.&lt;/p&gt;
 </description>
     <pubDate>Sat, 27 Sep 2008 13:03:34 +0000</pubDate>
 <dc:creator>wishstik</dc:creator>
 <guid isPermaLink="false">comment 1233948 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>&lt;script...&gt;function</title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/javascript-multiplying-numbers-live-page#comment-1233947</link>
    <description> &lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;script...&amp;gt;&lt;br /&gt;function getRecipe(numServings) {	 &lt;br /&gt;	 var wheat = 222;&lt;br /&gt;	 	 var wheatMeas = &amp;quot;g&amp;quot;;&lt;br /&gt;	 var ryeFlour = 222;&lt;br /&gt;	 	 var ryeFlourMeas = &amp;quot;g&amp;quot;;&lt;br /&gt;	 var water = 288;&lt;br /&gt;	 	 var waterMeas = &amp;quot;mL&amp;quot;;&lt;br /&gt;	 if (numServings != 1) {&lt;br /&gt;	 	 wheat *= numServings;&lt;br /&gt;	 	 ryeFlour *= numServings;&lt;br /&gt;	 	 water *= numServings;&lt;br /&gt;	 }&lt;br /&gt;	 document.getElementById(&amp;quot;recipe&amp;quot;).innerHTML = wheat+wheatMeas+&amp;quot; wheat&amp;lt;br /&amp;gt;&amp;quot;+ryeFlour+ryeFlourMeas+&amp;quot; rye flour&amp;lt;br /&amp;gt;&amp;quot;+water+waterMeas+&amp;quot;water&amp;quot;;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;form name=&amp;quot;getRecipe&amp;quot;&amp;gt;&lt;br /&gt;	 &amp;lt;input type=&amp;quot;text&amp;quot; id=&amp;quot;numServings&amp;quot; onchange=&amp;quot;getRecipe(this.value)&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;div id=&amp;quot;recipe&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;!--Show recipe info...--&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;This code certainly isn&#039;t perfect, but it should provide a basic idea for doing what you want.  Simple multiplication should work as long as you declare the initial measurements at the beginning.  Displaying the results is up to you, if you want to make the whole recipe a list and change each list item separately, that would probably be most correct, but this solution works fine as well. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sat, 27 Sep 2008 12:51:48 +0000</pubDate>
 <dc:creator>mscreashuns</dc:creator>
 <guid isPermaLink="false">comment 1233947 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
