Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Pure VPN - Up to 27 Months
vgp
Updated:
Friday at 8:10 AM
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
May 30, 2026
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Javascript Help Ekak Ona.
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="kolavari" data-source="post: 21003527" data-attributes="member: 412792"><p>හරි ඔන්න මම ප්ලගින් එකේ කෝඩ් එක එලියට අරන් නෝමල් js functions විදිහට ලිව්වා...</p><p></p><p>දැන් හරි..<img src="/styles/default/xenforo/smilies/default/yes.gif" class="smilie" loading="lazy" alt=":yes:" title="Yes :yes:" data-shortname=":yes:" /><img src="/styles/default/xenforo/smilies/default/yes.gif" class="smilie" loading="lazy" alt=":yes:" title="Yes :yes:" data-shortname=":yes:" /> දැන් නිකන් ම function එකට කෝල් කරනවා වගේ ගන්න තියෙන්නේ <img src="/styles/default/xenforo/smilies/default/yes.gif" class="smilie" loading="lazy" alt=":yes:" title="Yes :yes:" data-shortname=":yes:" /></p><p></p><p>[HTML]<!doctype html></p><p><html></p><p><head></p><p><script src="jquery-1.12.4.js"></script></p><p><script type="text/javascript" language="javascript" src="jquery.num2words.js"></script></p><p></p><p><script type="text/javascript"></p><p></p><p>$(document).ready(function() {</p><p> var textboxval = $("#num").val();</p><p> alert(numberToWords(textboxval));</p><p>}); </p><p></p><p></p><p></script></p><p></p><p></head></p><p><body></p><p></p><p><div id="demo"></p><p> <form action="test.php" id="Form1" method="get"></p><p> <input id="num" name="num" value="150" type="text"><br></p><p> </form></p><p> <div></div></p><p> </p><p></div></p><p></p><p></p><p></p><p><script></p><p> var units = [ "", "One", "Two", "Three", "Four", "Five", "Six","Seven", "Eight", "Nine", "Ten" ];</p><p> var teens = [ "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen","Sixteen", "Seventeen", "Eighteen", "Nineteen", "Twenty" ];</p><p> var tens = [ "", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty","Seventy", "Eighty", "Ninety" ];</p><p> var othersIntl = [ "Thousand", "Million", "Billion", "Trillion" ];</p><p></p><p> var getBelowHundred = function(n) {</p><p> if (n >= 100) {</p><p> return "greater than or equal to 100";</p><p> };</p><p> if (n <= 10) {</p><p> return units[n];</p><p> };</p><p> if (n <= 20) {</p><p> return teens[n - 10 - 1];</p><p> };</p><p> var unit = Math.floor(n % 10);</p><p> n /= 10;</p><p> var ten = Math.floor(n % 10);</p><p> var tenWord = (ten > 0 ? (tens[ten] + " ") : '');</p><p> var unitWord = (unit > 0 ? units[unit] : '');</p><p> return tenWord + unitWord;</p><p> };</p><p> </p><p> var getBelowThousand = function(n) {</p><p> if (n >= 1000) {</p><p> return "greater than or equal to 1000";</p><p> };</p><p> var word = getBelowHundred(Math.floor(n % 100));</p><p> </p><p> n = Math.floor(n / 100);</p><p> var hun = Math.floor(n % 10);</p><p> word = (hun > 0 ? (units[hun] + " Hundred ") : '') + word;</p><p> </p><p> return word;</p><p> };</p><p></p><p> function numberToWords(n) {</p><p> if (isNaN(n)) {</p><p> return "Not a number";</p><p> };</p><p> </p><p> var word = '';</p><p> var val;</p><p> var word2 = '';</p><p> var val2;</p><p> var b = n.split(".");</p><p> n = b[0];</p><p> d = b[1];</p><p> d = String (d);</p><p> d = d.substr(0,2);</p><p> </p><p> val = Math.floor(n % 1000);</p><p> n = Math.floor(n / 1000);</p><p> </p><p> val2 = Math.floor(d % 1000);</p><p> d = Math.floor(d / 1000);</p><p> </p><p> word = getBelowThousand(val);</p><p> word2 = getBelowThousand(val2);</p><p> </p><p> othersArr = othersIntl;</p><p> divisor = 1000;</p><p> func = getBelowThousand;</p><p></p><p> var i = 0;</p><p> while (n > 0) {</p><p> if (i == othersArr.length - 1) {</p><p> word = this.numberToWords(n) + " " + othersArr[i] + " " + word;</p><p> break;</p><p> };</p><p> val = Math.floor(n % divisor);</p><p> n = Math.floor(n / divisor);</p><p> if (val != 0) {</p><p> word = func(val) + " " + othersArr[i] + " " + word;</p><p> };</p><p> i++;</p><p> };</p><p> </p><p> var i = 0;</p><p> while (d > 0) {</p><p> if (i == othersArr.length - 1) {</p><p> word2 = this.numberToWords(d) + " " + othersArr[i] + " " + word2;</p><p> break;</p><p> };</p><p> val2 = Math.floor(d % divisor);</p><p> d = Math.floor(d / divisor);</p><p> if (val2 != 0) {</p><p> word2 = func(val2) + " " + othersArr[i] + " " + word2;</p><p> };</p><p> i++;</p><p> };</p><p> if (word!='') word = word + ' Rupees';</p><p> if (word2!='') word2 = ' And Cents ' + word2;</p><p> word3 = ' Only';</p><p> return word+word2+word3; </p><p> }</p><p></p><p></script></p><p></body></p><p></html>[/HTML]</p></blockquote><p></p>
[QUOTE="kolavari, post: 21003527, member: 412792"] හරි ඔන්න මම ප්ලගින් එකේ කෝඩ් එක එලියට අරන් නෝමල් js functions විදිහට ලිව්වා... දැන් හරි..:yes::yes: දැන් නිකන් ම function එකට කෝල් කරනවා වගේ ගන්න තියෙන්නේ :yes: [HTML]<!doctype html> <html> <head> <script src="jquery-1.12.4.js"></script> <script type="text/javascript" language="javascript" src="jquery.num2words.js"></script> <script type="text/javascript"> $(document).ready(function() { var textboxval = $("#num").val(); alert(numberToWords(textboxval)); }); </script> </head> <body> <div id="demo"> <form action="test.php" id="Form1" method="get"> <input id="num" name="num" value="150" type="text"><br> </form> <div></div> </div> <script> var units = [ "", "One", "Two", "Three", "Four", "Five", "Six","Seven", "Eight", "Nine", "Ten" ]; var teens = [ "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen","Sixteen", "Seventeen", "Eighteen", "Nineteen", "Twenty" ]; var tens = [ "", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty","Seventy", "Eighty", "Ninety" ]; var othersIntl = [ "Thousand", "Million", "Billion", "Trillion" ]; var getBelowHundred = function(n) { if (n >= 100) { return "greater than or equal to 100"; }; if (n <= 10) { return units[n]; }; if (n <= 20) { return teens[n - 10 - 1]; }; var unit = Math.floor(n % 10); n /= 10; var ten = Math.floor(n % 10); var tenWord = (ten > 0 ? (tens[ten] + " ") : ''); var unitWord = (unit > 0 ? units[unit] : ''); return tenWord + unitWord; }; var getBelowThousand = function(n) { if (n >= 1000) { return "greater than or equal to 1000"; }; var word = getBelowHundred(Math.floor(n % 100)); n = Math.floor(n / 100); var hun = Math.floor(n % 10); word = (hun > 0 ? (units[hun] + " Hundred ") : '') + word; return word; }; function numberToWords(n) { if (isNaN(n)) { return "Not a number"; }; var word = ''; var val; var word2 = ''; var val2; var b = n.split("."); n = b[0]; d = b[1]; d = String (d); d = d.substr(0,2); val = Math.floor(n % 1000); n = Math.floor(n / 1000); val2 = Math.floor(d % 1000); d = Math.floor(d / 1000); word = getBelowThousand(val); word2 = getBelowThousand(val2); othersArr = othersIntl; divisor = 1000; func = getBelowThousand; var i = 0; while (n > 0) { if (i == othersArr.length - 1) { word = this.numberToWords(n) + " " + othersArr[i] + " " + word; break; }; val = Math.floor(n % divisor); n = Math.floor(n / divisor); if (val != 0) { word = func(val) + " " + othersArr[i] + " " + word; }; i++; }; var i = 0; while (d > 0) { if (i == othersArr.length - 1) { word2 = this.numberToWords(d) + " " + othersArr[i] + " " + word2; break; }; val2 = Math.floor(d % divisor); d = Math.floor(d / divisor); if (val2 != 0) { word2 = func(val2) + " " + othersArr[i] + " " + word2; }; i++; }; if (word!='') word = word + ' Rupees'; if (word2!='') word2 = ' And Cents ' + word2; word3 = ' Only'; return word+word2+word3; } </script> </body> </html>[/HTML] [/QUOTE]
Insert quotes…
Verification
Awruddata maasa keeyada?
Post reply
Top
Bottom