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:
Jun 2, 2026
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 Help
JAVASCRIPT HELP please
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="වින්ඩොස් 8" data-source="post: 13852933" data-attributes="member: 439987"><p><span style="font-size: 18px">මචන්ලා මට මේක කවුරු හරි කරල දෙන්න කරුණාකරල<img src="/styles/default/xenforo/smilies/default/sad.gif" class="smilie" loading="lazy" alt=":(" title="Sad :(" data-shortname=":(" /><img src="/styles/default/xenforo/smilies/default/sad.gif" class="smilie" loading="lazy" alt=":(" title="Sad :(" data-shortname=":(" /><img src="/styles/default/xenforo/smilies/default/sad.gif" class="smilie" loading="lazy" alt=":(" title="Sad :(" data-shortname=":(" /><img src="/styles/default/xenforo/smilies/default/sad.gif" class="smilie" loading="lazy" alt=":(" title="Sad :(" data-shortname=":(" /></span></p><p><span style="font-size: 18px">ලොකු උදව්වකි</span><img src="/styles/default/xenforo/smilies/default/sad.gif" class="smilie" loading="lazy" alt=":(" title="Sad :(" data-shortname=":(" /></p><p> <strong>(More Javascripting) </strong></p><p></p><p> <strong>Program 1: </strong></p><p> <span style="color: black">Read the user's name from the prompt box as a string</span>. Use that name to print, "Hi, <name>"</p><p> <p style="text-align: center"><p style="text-align: center"> </p> </p><p> <strong>Program 2: <span style="color: black"> </span></strong></p><p> Prompt the user for 2 numbers (say, x and y). Compare the two numbers. If x is greater than y, print "x is greater than y". If y is greater than x, print "y is greater than x". (make sure you print the actual numbers entered by the user)</p><p> <p style="text-align: center"><p style="text-align: center"> </p> </p><p> <strong>Program 3: </strong></p><p> Get today's date using the Date class. Print the date, month, and year. If the day is a weekday, print "uh..oh...it is a weekday". If the day is either Saturday or Sunday, print "Great...It is the weekend". </p><p> Use the following methods:</p><p> <strong>getFullYear ( ) - </strong>Retrieves the year component of the date as a 4-digit number.</p><p> <strong>getMonth ( ) - </strong>Retrieves the month component of the date as a number from 0 to 11 (0=January, 1=February, etc)</p><p> <strong>getDate ( ) - </strong>Retrieves the day-of-month component of the date as a number from 1 to 31</p><p> <strong>getDay ( ) - </strong>Retrieves the day of the week component of the date as a number from 0 to 6 (0=Sunday, 1=Monday, etc)</p><p> Sample code:</p><p> The following code prints today's date and month.</p><p> <html></p><p> <head></p><p> <title>Write the Date</title></p><p> <script language="JavaScript"></p><p> <!-- hide me</p><p> </p><p> // get the date information</p><p> //</p><p> var today = new Date();</p><p> var the_day = today.getDate();</p><p> var the_month = today.getMonth();</p><p> </p><p> // correct for the month starting from zero</p><p> //</p><p> the_month = the_month + 1;</p><p> </p><p> // create the string you want to print</p><p> //</p><p> var the_whole_date = the_month + "/" + the_day;</p><p> </p><p> // show me --></p><p> </script></p><p> </head></p><p> <body></p><p> </p><p> Today's date is:</p><p> </p><p> <script language="JavaScript"></p><p> <!-- hide me</p><p> </p><p> // write the date</p><p> //</p><p> document.write(the_whole_date);</p><p> </p><p> // show me --></p><p> </script></p><p> </p><p> </body></p><p> </html></p><p> </p><p> <p style="text-align: center"><p style="text-align: center"> </p> </p><p> <strong>Program 4:</strong></p><p> <span style="color: teal">[FONT=&quot]<![/FONT]</span><span style="color: #3F7F7F">[FONT=&quot]DOCTYPE[/FONT]</span>[FONT=&quot] <span style="color: teal">html</span> <span style="color: gray">PUBLIC</span> <span style="color: teal">"-//W3C//DTD HTML 4.01 Transitional//EN"</span> <span style="color: #3F7F5F">"http://www.w3.org/TR/html4/loose.dtd"</span><span style="color: teal">></span>[/FONT]</p><p> <span style="color: teal">[FONT=&quot]<[/FONT]</span><span style="color: #3F7F7F">[FONT=&quot]html[/FONT]</span><span style="color: teal">[FONT=&quot]>[/FONT]</span>[FONT=&quot][/FONT]</p><p> <span style="color: teal">[FONT=&quot]<[/FONT]</span><span style="color: #3F7F7F">[FONT=&quot]head[/FONT]</span><span style="color: teal">[FONT=&quot]>[/FONT]</span>[FONT=&quot][/FONT]</p><p> <span style="color: teal">[FONT=&quot]<[/FONT]</span><span style="color: #3F7F7F">[FONT=&quot]meta[/FONT]</span>[FONT=&quot] <span style="color: #7F007F">http-equiv</span><span style="color: black">=</span><em><span style="color: #2A00FF">"Content-Type"</span></em> <span style="color: #7F007F">content</span><span style="color: black">=</span><em><span style="color: #2A00FF">"text/html; charset=ISO-8859-1"</span></em><span style="color: teal">></span>[/FONT]</p><p> <span style="color: teal">[FONT=&quot]<[/FONT]</span><span style="color: #3F7F7F">[FONT=&quot]title[/FONT]</span><span style="color: teal">[FONT=&quot]>[/FONT]</span><span style="color: black">[FONT=&quot]Insert title here[/FONT]</span><span style="color: teal">[FONT=&quot]</[/FONT]</span><span style="color: #3F7F7F">[FONT=&quot]title[/FONT]</span><span style="color: teal">[FONT=&quot]>[/FONT]</span>[FONT=&quot][/FONT]</p><p> <span style="color: teal">[FONT=&quot]</[/FONT]</span><span style="color: #3F7F7F">[FONT=&quot]head[/FONT]</span><span style="color: teal">[FONT=&quot]>[/FONT]</span>[FONT=&quot][/FONT]</p><p> <span style="color: teal">[FONT=&quot]<[/FONT]</span><span style="color: #3F7F7F">[FONT=&quot]body[/FONT]</span><span style="color: teal">[FONT=&quot]>[/FONT]</span>[FONT=&quot][/FONT]</p><p> <span style="color: teal">[FONT=&quot]<[/FONT]</span><span style="color: #3F7F7F">[FONT=&quot]script[/FONT]</span>[FONT=&quot] <span style="color: #7F007F">type</span><span style="color: black">=</span><em><span style="color: #2A00FF">"text/javascript"</span></em><span style="color: teal">></span>[/FONT]</p><p> [FONT=&quot] [/FONT]</p><p> [FONT=&quot]if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);[/FONT]</p><p> [FONT=&quot] var ffversion=new Number(RegExp.$1) // capture x.x portion and store as a number[/FONT]</p><p> [FONT=&quot] if (ffversion>=3)[/FONT]</p><p> [FONT=&quot] document.write("You're using FF 3.x or above")[/FONT]</p><p> [FONT=&quot] else if (ffversion>=2)[/FONT]</p><p> [FONT=&quot] document.write("You're using FF 2.x")[/FONT]</p><p> [FONT=&quot] else if (ffversion>=1)[/FONT]</p><p> [FONT=&quot] document.write("You're using FF 1.x")[/FONT]</p><p> [FONT=&quot]}[/FONT]</p><p> [FONT=&quot]else if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;[/FONT]</p><p> [FONT=&quot] var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number[/FONT]</p><p> [FONT=&quot] if (ieversion>=8)[/FONT]</p><p> [FONT=&quot] document.write("You're using IE8 or above")[/FONT]</p><p> [FONT=&quot] else if (ieversion>=7)[/FONT]</p><p> [FONT=&quot] document.write("You're using IE7.x")[/FONT]</p><p> [FONT=&quot] else if (ieversion>=6)[/FONT]</p><p> [FONT=&quot] document.write("You're using IE6.x")[/FONT]</p><p> [FONT=&quot] else if (ieversion>=5)[/FONT]</p><p> [FONT=&quot] document.write("You're using IE5.x")[/FONT]</p><p> [FONT=&quot]}[/FONT]</p><p> [FONT=&quot]else[/FONT]</p><p> [FONT=&quot] document.write("n/a")[/FONT]</p><p> [FONT=&quot] document.write("n/a")[/FONT]</p><p> [FONT=&quot] [/FONT]</p><p> <span style="color: teal">[FONT=&quot]</[/FONT]</span><span style="color: #3F7F7F">[FONT=&quot]script[/FONT]</span><span style="color: teal">[FONT=&quot]>[/FONT]</span>[FONT=&quot][/FONT]</p><p> [FONT=&quot] [/FONT]</p><p> <span style="color: teal">[FONT=&quot]</[/FONT]</span><span style="color: #3F7F7F">[FONT=&quot]body[/FONT]</span><span style="color: teal">[FONT=&quot]>[/FONT]</span>[FONT=&quot][/FONT]</p><p> <span style="color: teal">[FONT=&quot]</[/FONT]</span><span style="color: #3F7F7F">[FONT=&quot]html[/FONT]</span><span style="color: teal">[FONT=&quot]>[/FONT]</span></p></blockquote><p></p>
[QUOTE="වින්ඩොස් 8, post: 13852933, member: 439987"] [SIZE=5]මචන්ලා මට මේක කවුරු හරි කරල දෙන්න කරුණාකරල:(:(:(:( ලොකු උදව්වකි[/SIZE]:( [B](More Javascripting) [/B] [B]Program 1: [/B] [COLOR=black]Read the user's name from the prompt box as a string[/COLOR]. Use that name to print, "Hi, <name>" [CENTER][CENTER] [/CENTER][/CENTER] [B]Program 2: [COLOR=black] [/COLOR][/B] Prompt the user for 2 numbers (say, x and y). Compare the two numbers. If x is greater than y, print "x is greater than y". If y is greater than x, print "y is greater than x". (make sure you print the actual numbers entered by the user) [CENTER][CENTER] [/CENTER][/CENTER] [B]Program 3: [/B] Get today's date using the Date class. Print the date, month, and year. If the day is a weekday, print "uh..oh...it is a weekday". If the day is either Saturday or Sunday, print "Great...It is the weekend". Use the following methods: [B]getFullYear ( ) - [/B]Retrieves the year component of the date as a 4-digit number. [B]getMonth ( ) - [/B]Retrieves the month component of the date as a number from 0 to 11 (0=January, 1=February, etc) [B]getDate ( ) - [/B]Retrieves the day-of-month component of the date as a number from 1 to 31 [B]getDay ( ) - [/B]Retrieves the day of the week component of the date as a number from 0 to 6 (0=Sunday, 1=Monday, etc) Sample code: The following code prints today's date and month. <html> <head> <title>Write the Date</title> <script language="JavaScript"> <!-- hide me // get the date information // var today = new Date(); var the_day = today.getDate(); var the_month = today.getMonth(); // correct for the month starting from zero // the_month = the_month + 1; // create the string you want to print // var the_whole_date = the_month + "/" + the_day; // show me --> </script> </head> <body> Today's date is: <script language="JavaScript"> <!-- hide me // write the date // document.write(the_whole_date); // show me --> </script> </body> </html> [CENTER][CENTER] [/CENTER][/CENTER] [B]Program 4:[/B] [COLOR=teal][FONT="]<![/FONT][/COLOR][COLOR=#3F7F7F][FONT="]DOCTYPE[/FONT][/COLOR][FONT="] [COLOR=teal]html[/COLOR] [COLOR=gray]PUBLIC[/COLOR] [COLOR=teal]"-//W3C//DTD HTML 4.01 Transitional//EN"[/COLOR] [COLOR=#3F7F5F]"http://www.w3.org/TR/html4/loose.dtd"[/COLOR][COLOR=teal]>[/COLOR][/FONT] [COLOR=teal][FONT="]<[/FONT][/COLOR][COLOR=#3F7F7F][FONT="]html[/FONT][/COLOR][COLOR=teal][FONT="]>[/FONT][/COLOR][FONT="][/FONT] [COLOR=teal][FONT="]<[/FONT][/COLOR][COLOR=#3F7F7F][FONT="]head[/FONT][/COLOR][COLOR=teal][FONT="]>[/FONT][/COLOR][FONT="][/FONT] [COLOR=teal][FONT="]<[/FONT][/COLOR][COLOR=#3F7F7F][FONT="]meta[/FONT][/COLOR][FONT="] [COLOR=#7F007F]http-equiv[/COLOR][COLOR=black]=[/COLOR][I][COLOR=#2A00FF]"Content-Type"[/COLOR][/I] [COLOR=#7F007F]content[/COLOR][COLOR=black]=[/COLOR][I][COLOR=#2A00FF]"text/html; charset=ISO-8859-1"[/COLOR][/I][COLOR=teal]>[/COLOR][/FONT] [COLOR=teal][FONT="]<[/FONT][/COLOR][COLOR=#3F7F7F][FONT="]title[/FONT][/COLOR][COLOR=teal][FONT="]>[/FONT][/COLOR][COLOR=black][FONT="]Insert title here[/FONT][/COLOR][COLOR=teal][FONT="]</[/FONT][/COLOR][COLOR=#3F7F7F][FONT="]title[/FONT][/COLOR][COLOR=teal][FONT="]>[/FONT][/COLOR][FONT="][/FONT] [COLOR=teal][FONT="]</[/FONT][/COLOR][COLOR=#3F7F7F][FONT="]head[/FONT][/COLOR][COLOR=teal][FONT="]>[/FONT][/COLOR][FONT="][/FONT] [COLOR=teal][FONT="]<[/FONT][/COLOR][COLOR=#3F7F7F][FONT="]body[/FONT][/COLOR][COLOR=teal][FONT="]>[/FONT][/COLOR][FONT="][/FONT] [COLOR=teal][FONT="]<[/FONT][/COLOR][COLOR=#3F7F7F][FONT="]script[/FONT][/COLOR][FONT="] [COLOR=#7F007F]type[/COLOR][COLOR=black]=[/COLOR][I][COLOR=#2A00FF]"text/javascript"[/COLOR][/I][COLOR=teal]>[/COLOR][/FONT] [FONT="] [/FONT] [FONT="]if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);[/FONT] [FONT="] var ffversion=new Number(RegExp.$1) // capture x.x portion and store as a number[/FONT] [FONT="] if (ffversion>=3)[/FONT] [FONT="] document.write("You're using FF 3.x or above")[/FONT] [FONT="] else if (ffversion>=2)[/FONT] [FONT="] document.write("You're using FF 2.x")[/FONT] [FONT="] else if (ffversion>=1)[/FONT] [FONT="] document.write("You're using FF 1.x")[/FONT] [FONT="]}[/FONT] [FONT="]else if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;[/FONT] [FONT="] var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number[/FONT] [FONT="] if (ieversion>=8)[/FONT] [FONT="] document.write("You're using IE8 or above")[/FONT] [FONT="] else if (ieversion>=7)[/FONT] [FONT="] document.write("You're using IE7.x")[/FONT] [FONT="] else if (ieversion>=6)[/FONT] [FONT="] document.write("You're using IE6.x")[/FONT] [FONT="] else if (ieversion>=5)[/FONT] [FONT="] document.write("You're using IE5.x")[/FONT] [FONT="]}[/FONT] [FONT="]else[/FONT] [FONT="] document.write("n/a")[/FONT] [FONT="] document.write("n/a")[/FONT] [FONT="] [/FONT] [COLOR=teal][FONT="]</[/FONT][/COLOR][COLOR=#3F7F7F][FONT="]script[/FONT][/COLOR][COLOR=teal][FONT="]>[/FONT][/COLOR][FONT="][/FONT] [FONT="] [/FONT] [COLOR=teal][FONT="]</[/FONT][/COLOR][COLOR=#3F7F7F][FONT="]body[/FONT][/COLOR][COLOR=teal][FONT="]>[/FONT][/COLOR][FONT="][/FONT] [COLOR=teal][FONT="]</[/FONT][/COLOR][COLOR=#3F7F7F][FONT="]html[/FONT][/COLOR][COLOR=teal][FONT="]>[/FONT][/COLOR] [/QUOTE]
Insert quotes…
Verification
Asuwa dahayen wadi kalama keeyada?
Post reply
Top
Bottom