Category: JavaScript

Simple Exam Grading System

Email Validation

This is very simple grading system based on single subject marks. var mark=60 if(mark>60) { document.write(“pass”); } else{ document.write(“Fail”) } */ var mark=prompt(“Enter Mark”); if(mark>100) { document.write(“Invalid”); } else if(mark>90) { document.write(“A”); } else if(mark>80) { document.write(“B”); } else if(mark>70)

HTML form data retrieve using javascript

Email Validation

Javascript data retrieve from HTML Form: Js: function display(){ var fname=document.forms[‘myForm’][‘fname’].value; document.getElementById(‘demoName’).innerHTML=fname; var gender=document.forms[‘myForm’][‘gender’].value; document.getElementById(‘demoGender’).innerHTML=gender; var hobb=document.forms[0]; var hob =””; for(i=0; i<hobb.length;i++){ if(hobb[i].checked){ hob=hob+hobb[i].value+”, “; } } document.getElementById(‘demoGHobby’).innerHTML=hob; var en=document.forms[1]; var entry =””; for(i=0; i<en.length;i++){ if(en[i].checked){ entry=entry+en[i].value+”, “; } }

Check Prime Number From Start to End Number

Email Validation

Source: function isPrime(num){ var n=Math.sqrt(num); for(i=2;i<=n;i++){ if(num%i==0) return false; } return true; } function checkPrimeNumbers(startNum, endNum){ for(startNum; startNum<=endNum; startNum++){ if(isPrime(startNum)){ document.writeln(startNum+” “+”Is Prime”); document.writeln(“<br/>”); }else{ document.writeln(startNum+” ” +”Is not prime”); document.writeln(“<br/>”); } } } Download Complete Source Code

X