SlideShare a Scribd company logo
1 of 7
Java Script භාවිත කර වෙබ් බ්‍රවුසරයක්
හරහා ක්‍රියාත්මක ෙන මාර්ග ගත
ප්‍රශ්නාෙලියක් තනමු
මහ ේෂ් හ ොඩිතුවක්කු
රූපහේ දැක්හවන ආ ාරහේ
මාර්ගගත ප්‍රශ්නාවලියක්
නිර්මාණය හ ොට එහි ලබා
දුන් නිවැරදි පිළිතුරු ගණන
අනුව ලකුණු ලබා හදන්හන්
හ හ ේ දැයි බලමු.හේ ඳ ා
ජාො ස්ක්‍රිප්ට් එ ක් භාවිත
ළ ැකි අතර එය ලිවිය ැකි
ආ ාර ද ගණනාවක් ම
තිහබනවා. එහ ත් මම හමහි දී
තා කිරීමට බලාහපොහරොත්තු
වන්හන් ඉතාමත් රල වගන්ති
කිහිපයක් භාවිත හ ොට හමම
ාර්යය ඉතා ප සුහවන් ර
ගත ැකි ආ ාරය පිළිබඳවයි.
<body>
<form name="form1" id="form1" method="post" action="">
<h3>What is the Capital of Sri lanka?</h3>
<input name="qs1" type="radio" id="qs1">Kandy<br/>
<input name="qs1" type="radio" id="qs1">Colombo<br/>
<input name="qs1" type="radio" id="q1">Sri Jayawardanapura
Kotte<br/>
මුලින්ම ප ත පරිදි හනෝට්පෑඩ් මෘදු ාාංගය හ ෝ රල පාඨ ාං ් රණ
මෘදු ාාංගයක් භාවිත හ ොට ඔබට අවශය ප්‍රශ්න කිහිපය ා ගන්න.
හමහි දී මම id එ අනුව නිවැරදි පිළිතුර ලබා ගන්නා නි ා නිවැරදි පිළිතුර
අයත් id එ ට පිළිහවලින් පළමුවන ප්‍රශ්නය ඳ ා q1 හල ද හදවන
ප්‍රශ්නය ට q2 හල ද යනා දී වශහයන් ලබා දී තිහබනවා. ප සුව ඳ ා
ප්‍රශ්න 3 ක් තනා හගන ඇති අතර හමහි දැක්හවන්හන් එහල තැනූ
පළමුවන ප්‍රශ්නයයි.
<input type="button" name="submit" Value="Submit"
onClick="calculatem()" type="submit">
<input type="reset" >
</form>
හමහි onClick="calculatem()“ මගින් Button එ Submit ළ විට
ෆන්ෂන් එ ක් ක්‍රියාත්ම කිරීමට අදාල ව අදාල ෆන්ෂන් එහ හි නම
ලියා තිහබනවා.
ප්‍රශ්න වල අව ානහේ හෆෝේ එ අව න් කිරීමට පළමුව මම හබොත්තේ
හද ක් නිර්මාණය ර ඇති අතර එ කින් නිවැරදි පිළිතුරු පයා ලකුණු
ගණන හ වීමට Submit කිරීමට ද අහනකින් අවශය නේ නැවත reset
කිරීම ද ළ ැකියි.
<script language="javaScript">
function calculatem()
{
var marks=0;
for (i=1; i<=3; i++){
if (document.getElementById("q"+i) .checked)
{
marks++;
}
}
alert ("Your Marks is "+ marks);
}
</script>
හමහි onClick="calculatem()“ මගින් Submit ළ විට ක්‍රියාත්ම වන
ෆන්ෂන් ලියන්හන් හවබ් පිටුහවහි <head></head>අතර වන අතර අපි
හමම ෆන්ෂන් එ පියවර වශහයන් ඳුනා ගනිමු.
<script language="javaScript">ජාො ස්ක්‍රිප්ට් එවකහි ආරම්භය
function calculatem() ෆන්ෂන් එක සඳහා ලබා දුන් නම
{
var marks=0; marksනමින් සකසන ලද විචලයය එය ආරම්භවේ දී
0 ට සමාන කර ඇත.
for (i=1; i<=3; i++){forලූප් එකක් මගින් එකින් එක බැගින් ප්‍රශ්න
ගණනට සමාන ලූප් එකක් ක්‍රියාත්මක කිරීම
if (document.getElementById("q"+i) .checked)
{id එකඅනුෙ ලබා ගත් ලකුණු ගණන ගණනය කිරීම
marks++;
}
}
alert ("Your Marks is "+ marks);ලකුණු ගණන දර්ශනය
}
</script>
Javascript සිංහලෙන්

More Related Content

What's hot

An introduction to microsoft office 2007 lecture
An introduction to microsoft office 2007 lectureAn introduction to microsoft office 2007 lecture
An introduction to microsoft office 2007 lectureSukh Sandhu
 
Introduction to Excel - Excel 2013 Tutorial
Introduction to Excel - Excel 2013 TutorialIntroduction to Excel - Excel 2013 Tutorial
Introduction to Excel - Excel 2013 TutorialSpreadsheetTrainer
 
Networks and the effects of using them
Networks and the effects of using themNetworks and the effects of using them
Networks and the effects of using themAnjan Mahanta
 
HTML & CSS Workshop Notes
HTML & CSS Workshop NotesHTML & CSS Workshop Notes
HTML & CSS Workshop NotesPamela Fox
 
HTML5: features with examples
HTML5: features with examplesHTML5: features with examples
HTML5: features with examplesAlfredo Torre
 
Word, excel, and power point tutorial in Tamil
Word, excel, and power point tutorial in TamilWord, excel, and power point tutorial in Tamil
Word, excel, and power point tutorial in TamilNiva tharan
 
PPT On Microsoft Excel 2007 Full Information.
PPT On Microsoft Excel 2007 Full Information.PPT On Microsoft Excel 2007 Full Information.
PPT On Microsoft Excel 2007 Full Information.Umesh Kumar
 
G.C.E O/L ICT Short Notes Grade-11
G.C.E O/L ICT Short Notes Grade-11G.C.E O/L ICT Short Notes Grade-11
G.C.E O/L ICT Short Notes Grade-11Mahesh Kodituwakku
 
Koodikerho (code club) presentation in English
Koodikerho (code club) presentation in EnglishKoodikerho (code club) presentation in English
Koodikerho (code club) presentation in EnglishOtto Kekäläinen
 
Lecture 2 introduction to html
Lecture 2  introduction to htmlLecture 2  introduction to html
Lecture 2 introduction to htmlpalhaftab
 
Introduction to xhtml
Introduction to xhtmlIntroduction to xhtml
Introduction to xhtmlDhairya Joshi
 
HTML/Web Development (Grade 11-ICT)
HTML/Web Development (Grade 11-ICT)HTML/Web Development (Grade 11-ICT)
HTML/Web Development (Grade 11-ICT)Mahesh Kodituwakku
 

What's hot (20)

An introduction to microsoft office 2007 lecture
An introduction to microsoft office 2007 lectureAn introduction to microsoft office 2007 lecture
An introduction to microsoft office 2007 lecture
 
G.C.E AL Model Papers
G.C.E AL Model PapersG.C.E AL Model Papers
G.C.E AL Model Papers
 
Introduction to Excel - Excel 2013 Tutorial
Introduction to Excel - Excel 2013 TutorialIntroduction to Excel - Excel 2013 Tutorial
Introduction to Excel - Excel 2013 Tutorial
 
Networks and the effects of using them
Networks and the effects of using themNetworks and the effects of using them
Networks and the effects of using them
 
Internet and Email -O/L ICT
Internet and Email -O/L ICTInternet and Email -O/L ICT
Internet and Email -O/L ICT
 
HTML & CSS Workshop Notes
HTML & CSS Workshop NotesHTML & CSS Workshop Notes
HTML & CSS Workshop Notes
 
Advance HTML
Advance HTMLAdvance HTML
Advance HTML
 
CSS Font & Text style
CSS Font & Text style CSS Font & Text style
CSS Font & Text style
 
HTML5: features with examples
HTML5: features with examplesHTML5: features with examples
HTML5: features with examples
 
Word, excel, and power point tutorial in Tamil
Word, excel, and power point tutorial in TamilWord, excel, and power point tutorial in Tamil
Word, excel, and power point tutorial in Tamil
 
PPT On Microsoft Excel 2007 Full Information.
PPT On Microsoft Excel 2007 Full Information.PPT On Microsoft Excel 2007 Full Information.
PPT On Microsoft Excel 2007 Full Information.
 
G.C.E O/L ICT Short Notes Grade-11
G.C.E O/L ICT Short Notes Grade-11G.C.E O/L ICT Short Notes Grade-11
G.C.E O/L ICT Short Notes Grade-11
 
Koodikerho (code club) presentation in English
Koodikerho (code club) presentation in EnglishKoodikerho (code club) presentation in English
Koodikerho (code club) presentation in English
 
Lecture 2 introduction to html
Lecture 2  introduction to htmlLecture 2  introduction to html
Lecture 2 introduction to html
 
Introduction to Html5
Introduction to Html5Introduction to Html5
Introduction to Html5
 
Introduction to xhtml
Introduction to xhtmlIntroduction to xhtml
Introduction to xhtml
 
Ms excel 2007 pptx
Ms excel 2007 pptxMs excel 2007 pptx
Ms excel 2007 pptx
 
HTML/Web Development (Grade 11-ICT)
HTML/Web Development (Grade 11-ICT)HTML/Web Development (Grade 11-ICT)
HTML/Web Development (Grade 11-ICT)
 
CSS.ppt
CSS.pptCSS.ppt
CSS.ppt
 
Bootstrap
BootstrapBootstrap
Bootstrap
 

Viewers also liked

G.C.E. O/L ICT Lessons Database sinhala
 G.C.E. O/L ICT Lessons Database sinhala G.C.E. O/L ICT Lessons Database sinhala
G.C.E. O/L ICT Lessons Database sinhalaMahesh Kodituwakku
 
Grade 10 ICT Short Notes in Sinhala(2015)
Grade 10 ICT Short Notes in Sinhala(2015)Grade 10 ICT Short Notes in Sinhala(2015)
Grade 10 ICT Short Notes in Sinhala(2015)Mahesh Kodituwakku
 
Operating Systems::: G.C.E O/L
Operating Systems::: G.C.E O/LOperating Systems::: G.C.E O/L
Operating Systems::: G.C.E O/LMahesh Kodituwakku
 
Input and Output Devicesආදාන හා ප්‍රතිදාන උපාංග
Input and Output Devicesආදාන හා ප්‍රතිදාන උපාංගInput and Output Devicesආදාන හා ප්‍රතිදාන උපාංග
Input and Output Devicesආදාන හා ප්‍රතිදාන උපාංගMahesh Kodituwakku
 
දත්ත සහ තොරතුරු
දත්ත සහ තොරතුරුදත්ත සහ තොරතුරු
දත්ත සහ තොරතුරුTennyson
 
පරිගණකයේ විකාශය
පරිගණකයේ විකාශයපරිගණකයේ විකාශය
පරිගණකයේ විකාශයRajith Pemabandu
 
Database Programming Project Assignment
Database Programming Project AssignmentDatabase Programming Project Assignment
Database Programming Project AssignmentMahesh Kodituwakku
 
ICT G.C.E O/L 2016 Model Paper
ICT G.C.E O/L 2016 Model PaperICT G.C.E O/L 2016 Model Paper
ICT G.C.E O/L 2016 Model PaperMahesh Kodituwakku
 
Ms Access ppt
Ms Access pptMs Access ppt
Ms Access pptanuj
 
USE OF SOCIAL NETWORKS AND ITS EFFECTS ON STUDENTS
USE OF SOCIAL NETWORKS AND ITS EFFECTS ON STUDENTS USE OF SOCIAL NETWORKS AND ITS EFFECTS ON STUDENTS
USE OF SOCIAL NETWORKS AND ITS EFFECTS ON STUDENTS Mahesh Kodituwakku
 
Types of networks c_paranamana
Types of networks c_paranamanaTypes of networks c_paranamana
Types of networks c_paranamanaCharee Paranamana
 

Viewers also liked (20)

G.C.E. O/L ICT Lessons Database sinhala
 G.C.E. O/L ICT Lessons Database sinhala G.C.E. O/L ICT Lessons Database sinhala
G.C.E. O/L ICT Lessons Database sinhala
 
Grade 10 ICT Short Notes in Sinhala(2015)
Grade 10 ICT Short Notes in Sinhala(2015)Grade 10 ICT Short Notes in Sinhala(2015)
Grade 10 ICT Short Notes in Sinhala(2015)
 
Magento in Sinhala
Magento in SinhalaMagento in Sinhala
Magento in Sinhala
 
Operating Systems::: G.C.E O/L
Operating Systems::: G.C.E O/LOperating Systems::: G.C.E O/L
Operating Systems::: G.C.E O/L
 
Network Devices
Network DevicesNetwork Devices
Network Devices
 
ICT in Sinhala
ICT in SinhalaICT in Sinhala
ICT in Sinhala
 
ICT Students Presentations
ICT Students PresentationsICT Students Presentations
ICT Students Presentations
 
ICT Lessons in Sinhala
ICT Lessons in SinhalaICT Lessons in Sinhala
ICT Lessons in Sinhala
 
Input and Output Devicesආදාන හා ප්‍රතිදාන උපාංග
Input and Output Devicesආදාන හා ප්‍රතිදාන උපාංගInput and Output Devicesආදාන හා ප්‍රතිදාන උපාංග
Input and Output Devicesආදාන හා ප්‍රතිදාන උපාංග
 
දත්ත සහ තොරතුරු
දත්ත සහ තොරතුරුදත්ත සහ තොරතුරු
දත්ත සහ තොරතුරු
 
පරිගණකයේ විකාශය
පරිගණකයේ විකාශයපරිගණකයේ විකාශය
පරිගණකයේ විකාශය
 
Database Programming Project Assignment
Database Programming Project AssignmentDatabase Programming Project Assignment
Database Programming Project Assignment
 
GIT Model Paper
GIT Model PaperGIT Model Paper
GIT Model Paper
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
 
Kmap
KmapKmap
Kmap
 
ICT G.C.E O/L 2016 Model Paper
ICT G.C.E O/L 2016 Model PaperICT G.C.E O/L 2016 Model Paper
ICT G.C.E O/L 2016 Model Paper
 
GCE O/L ICT
GCE O/L ICT GCE O/L ICT
GCE O/L ICT
 
Ms Access ppt
Ms Access pptMs Access ppt
Ms Access ppt
 
USE OF SOCIAL NETWORKS AND ITS EFFECTS ON STUDENTS
USE OF SOCIAL NETWORKS AND ITS EFFECTS ON STUDENTS USE OF SOCIAL NETWORKS AND ITS EFFECTS ON STUDENTS
USE OF SOCIAL NETWORKS AND ITS EFFECTS ON STUDENTS
 
Types of networks c_paranamana
Types of networks c_paranamanaTypes of networks c_paranamana
Types of networks c_paranamana
 

More from Mahesh Kodituwakku

DFD,Activity Diagram ,Document Flow Diagram
DFD,Activity Diagram ,Document Flow DiagramDFD,Activity Diagram ,Document Flow Diagram
DFD,Activity Diagram ,Document Flow DiagramMahesh Kodituwakku
 
G.C.E O/L Model Papers( for 2019)
G.C.E O/L Model Papers( for 2019)G.C.E O/L Model Papers( for 2019)
G.C.E O/L Model Papers( for 2019)Mahesh Kodituwakku
 
දකුණු පලාත් උසස් පෙළ තොරතුරු තාක්ෂණය ප්‍රශ්න පත්‍රය 2019
දකුණු පලාත් උසස් පෙළ තොරතුරු තාක්ෂණය ප්‍රශ්න පත්‍රය 2019දකුණු පලාත් උසස් පෙළ තොරතුරු තාක්ෂණය ප්‍රශ්න පත්‍රය 2019
දකුණු පලාත් උසස් පෙළ තොරතුරු තාක්ෂණය ප්‍රශ්න පත්‍රය 2019Mahesh Kodituwakku
 
7 වන ඒකකය - පද්ධති විශ්ලේශනය හා පිරිසැලසුම
7 වන ඒකකය - පද්ධති විශ්ලේශනය හා පිරිසැලසුම7 වන ඒකකය - පද්ධති විශ්ලේශනය හා පිරිසැලසුම
7 වන ඒකකය - පද්ධති විශ්ලේශනය හා පිරිසැලසුමMahesh Kodituwakku
 

More from Mahesh Kodituwakku (20)

AL ICT -Part 2
AL ICT -Part 2AL ICT -Part 2
AL ICT -Part 2
 
AL ICT -Part 1
AL ICT -Part 1AL ICT -Part 1
AL ICT -Part 1
 
ICT Model Paper
ICT Model PaperICT Model Paper
ICT Model Paper
 
AL ICT Lesson 1 Questions
AL ICT Lesson 1 QuestionsAL ICT Lesson 1 Questions
AL ICT Lesson 1 Questions
 
OSI Model
OSI ModelOSI Model
OSI Model
 
G.C.E O/L and A/L Lessons
G.C.E O/L and A/L LessonsG.C.E O/L and A/L Lessons
G.C.E O/L and A/L Lessons
 
G.C.E. O/L ICT(Lesson 1)
G.C.E. O/L ICT(Lesson 1)G.C.E. O/L ICT(Lesson 1)
G.C.E. O/L ICT(Lesson 1)
 
G.C.E.AL ICT
G.C.E.AL ICT G.C.E.AL ICT
G.C.E.AL ICT
 
G.C.E. O/L ICT
G.C.E. O/L ICTG.C.E. O/L ICT
G.C.E. O/L ICT
 
AI
AIAI
AI
 
DFD,Activity Diagram ,Document Flow Diagram
DFD,Activity Diagram ,Document Flow DiagramDFD,Activity Diagram ,Document Flow Diagram
DFD,Activity Diagram ,Document Flow Diagram
 
AL ICT Lesson 13
AL ICT Lesson 13AL ICT Lesson 13
AL ICT Lesson 13
 
HTML Questions
HTML QuestionsHTML Questions
HTML Questions
 
G.C.E O/L Model Papers( for 2019)
G.C.E O/L Model Papers( for 2019)G.C.E O/L Model Papers( for 2019)
G.C.E O/L Model Papers( for 2019)
 
G.C.E A/L ICT Grade 12 paper
G.C.E A/L ICT Grade 12 paperG.C.E A/L ICT Grade 12 paper
G.C.E A/L ICT Grade 12 paper
 
දකුණු පලාත් උසස් පෙළ තොරතුරු තාක්ෂණය ප්‍රශ්න පත්‍රය 2019
දකුණු පලාත් උසස් පෙළ තොරතුරු තාක්ෂණය ප්‍රශ්න පත්‍රය 2019දකුණු පලාත් උසස් පෙළ තොරතුරු තාක්ෂණය ප්‍රශ්න පත්‍රය 2019
දකුණු පලාත් උසස් පෙළ තොරතුරු තාක්ෂණය ප්‍රශ්න පත්‍රය 2019
 
Arduino Basic for Grade 9
Arduino Basic for Grade 9Arduino Basic for Grade 9
Arduino Basic for Grade 9
 
ICT Grade 8 and 9
ICT Grade 8 and 9ICT Grade 8 and 9
ICT Grade 8 and 9
 
Grade 7 ICT
Grade 7 ICTGrade 7 ICT
Grade 7 ICT
 
7 වන ඒකකය - පද්ධති විශ්ලේශනය හා පිරිසැලසුම
7 වන ඒකකය - පද්ධති විශ්ලේශනය හා පිරිසැලසුම7 වන ඒකකය - පද්ධති විශ්ලේශනය හා පිරිසැලසුම
7 වන ඒකකය - පද්ධති විශ්ලේශනය හා පිරිසැලසුම
 

Javascript සිංහලෙන්

  • 1. Java Script භාවිත කර වෙබ් බ්‍රවුසරයක් හරහා ක්‍රියාත්මක ෙන මාර්ග ගත ප්‍රශ්නාෙලියක් තනමු මහ ේෂ් හ ොඩිතුවක්කු
  • 2. රූපහේ දැක්හවන ආ ාරහේ මාර්ගගත ප්‍රශ්නාවලියක් නිර්මාණය හ ොට එහි ලබා දුන් නිවැරදි පිළිතුරු ගණන අනුව ලකුණු ලබා හදන්හන් හ හ ේ දැයි බලමු.හේ ඳ ා ජාො ස්ක්‍රිප්ට් එ ක් භාවිත ළ ැකි අතර එය ලිවිය ැකි ආ ාර ද ගණනාවක් ම තිහබනවා. එහ ත් මම හමහි දී තා කිරීමට බලාහපොහරොත්තු වන්හන් ඉතාමත් රල වගන්ති කිහිපයක් භාවිත හ ොට හමම ාර්යය ඉතා ප සුහවන් ර ගත ැකි ආ ාරය පිළිබඳවයි.
  • 3. <body> <form name="form1" id="form1" method="post" action=""> <h3>What is the Capital of Sri lanka?</h3> <input name="qs1" type="radio" id="qs1">Kandy<br/> <input name="qs1" type="radio" id="qs1">Colombo<br/> <input name="qs1" type="radio" id="q1">Sri Jayawardanapura Kotte<br/> මුලින්ම ප ත පරිදි හනෝට්පෑඩ් මෘදු ාාංගය හ ෝ රල පාඨ ාං ් රණ මෘදු ාාංගයක් භාවිත හ ොට ඔබට අවශය ප්‍රශ්න කිහිපය ා ගන්න. හමහි දී මම id එ අනුව නිවැරදි පිළිතුර ලබා ගන්නා නි ා නිවැරදි පිළිතුර අයත් id එ ට පිළිහවලින් පළමුවන ප්‍රශ්නය ඳ ා q1 හල ද හදවන ප්‍රශ්නය ට q2 හල ද යනා දී වශහයන් ලබා දී තිහබනවා. ප සුව ඳ ා ප්‍රශ්න 3 ක් තනා හගන ඇති අතර හමහි දැක්හවන්හන් එහල තැනූ පළමුවන ප්‍රශ්නයයි.
  • 4. <input type="button" name="submit" Value="Submit" onClick="calculatem()" type="submit"> <input type="reset" > </form> හමහි onClick="calculatem()“ මගින් Button එ Submit ළ විට ෆන්ෂන් එ ක් ක්‍රියාත්ම කිරීමට අදාල ව අදාල ෆන්ෂන් එහ හි නම ලියා තිහබනවා. ප්‍රශ්න වල අව ානහේ හෆෝේ එ අව න් කිරීමට පළමුව මම හබොත්තේ හද ක් නිර්මාණය ර ඇති අතර එ කින් නිවැරදි පිළිතුරු පයා ලකුණු ගණන හ වීමට Submit කිරීමට ද අහනකින් අවශය නේ නැවත reset කිරීම ද ළ ැකියි.
  • 5. <script language="javaScript"> function calculatem() { var marks=0; for (i=1; i<=3; i++){ if (document.getElementById("q"+i) .checked) { marks++; } } alert ("Your Marks is "+ marks); } </script> හමහි onClick="calculatem()“ මගින් Submit ළ විට ක්‍රියාත්ම වන ෆන්ෂන් ලියන්හන් හවබ් පිටුහවහි <head></head>අතර වන අතර අපි හමම ෆන්ෂන් එ පියවර වශහයන් ඳුනා ගනිමු.
  • 6. <script language="javaScript">ජාො ස්ක්‍රිප්ට් එවකහි ආරම්භය function calculatem() ෆන්ෂන් එක සඳහා ලබා දුන් නම { var marks=0; marksනමින් සකසන ලද විචලයය එය ආරම්භවේ දී 0 ට සමාන කර ඇත. for (i=1; i<=3; i++){forලූප් එකක් මගින් එකින් එක බැගින් ප්‍රශ්න ගණනට සමාන ලූප් එකක් ක්‍රියාත්මක කිරීම if (document.getElementById("q"+i) .checked) {id එකඅනුෙ ලබා ගත් ලකුණු ගණන ගණනය කිරීම marks++; } } alert ("Your Marks is "+ marks);ලකුණු ගණන දර්ශනය } </script>