Sunday, 29 December 2024

Write a program Validation using Javascript

 <html>

<head>

<script>

function myFunction() {

  // Get the value of the input field with id="numb"

  let x = document.getElementById("numb").value;

  // If x is Not a Number or less than one or greater than 10

  let text;

  if (isNaN(x) || x < 1 || x > 10) {

    text = "Input not valid";

  } else {

    text = "Input OK";

  }

  document.getElementById("demo").innerHTML = text;

}

</script>

</head>

<body>

<h2>JavaScript Validation</h2>

<p>Please input a number between 1 and 10:</p>

<input id="numb">

<button type="button" onclick="myFunction()">Submit</button>

<p id="demo"></p>

</body>

</html> 
















Thursday, 26 December 2024

Write a program Count Vowels using Javascript

<html>

<head>

<title>find number of vowels in a string in JavaScript</title>

<script type="text/javascript">

function GetVowels() {

var str = document.getElementById('txtname').value;

var count = 0, total_vowels="";

for (var i = 0; i < str.length; i++) {

if (str.charAt(i).match(/[a-zA-Z]/) != null) {

// findVowels

if (str.charAt(i).match(/[aeiouAEIOU]/))

{

total_vowels = total_vowels + str.charAt(i);

count++;

}

}

}

document.getElementById('vowels').value = total_vowels;

document.getElementById('vcount').value = count;

}

</script>

</head>

<body>

<div >

<table border="1px" cellspacing="0" width="30%" style="background-color: #FF6600; color:White">

<tr><td colspan="2" align="center"><b>Get Vowels from String</b></td></tr>

<tr>

<td>Enter Text :</td>

<td><input type='text' id='txtname' /></td>

</tr>

<tr>

<td>Vowels Count :</td>

<td><input type='text' readonly="readonly" id='vcount'/></td>

</tr>

<tr>

<td>Total Vowels :</td>

<td><input type='text' readonly="readonly" id='vowels' /></td>

</tr>

<tr>

<td></td>

<td><input type='button' value='Get Vowels Count' onclick="javascript:GetVowels();" /></td>

</tr>

</table>

</div>

</body>

</html>








Wednesday, 18 December 2024

Write Program To Subtract Two number using javascript

 <!doctype html>

<html>

<head>

<script>

function Sub()

{

  var numOne, numTwo, sum;

  numOne = parseInt(document.getElementById("first").value);

  numTwo = parseInt(document.getElementById("second").value);

  sum = numOne - numTwo;

  document.getElementById("answer").value = sum;

}

</script>

</head>

<body>

<p>Enter the First Number: <input id="first"></p>

<p>Enter the Second Number: <input id="second"></p>

<button onclick="Sub()">Sub</button>

<p>Sum = <input id="answer"></p>

</body>

</html>















Write Program To Add Two number using javascript

 


<!doctype html>

<html>

<head>

<script>

function add()

{

  var numOne, numTwo, sum;

  numOne = parseInt(document.getElementById("first").value);

  numTwo = parseInt(document.getElementById("second").value);

  sum = numOne + numTwo;

  document.getElementById("answer").value = sum;

}

</script>

</head>

<body>


<p>Enter the First Number: <input id="first"></p>

<p>Enter the Second Number: <input id="second"></p>

<button onclick="add()">Add</button>

<p>Sum = <input id="answer"></p>


</body>

</html>

Monday, 16 December 2024

Write a program to login page using Form Tag in html

Write a program to login page using Form Tag in html

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Form Tag</title>

</head>

<body>

<table border="1">

<form>

<tr>

<td>Enter Your Name:<input type="text" name="t1" required></td>

</tr>

<tr>

<td>Enter Password:<input type="Password" name="p1" required></td>

</tr>

<tr>

<td><button>Submit</button> &nbsp;<button>Cancle</button></td>

</tr>

</form>

</table>

</body>

</html>


Write a program to Confirm Dilog Box

 


<html>

<body>

<h2>JavaScript Confirm Box</h2>


<button onclick="myFunction()">Click Me</button>

<p id="demo"></p>

<script>

function myFunction() {

  var txt;

  if (confirm("Press a button!")) {

    txt = "You pressed OK!";

  } else {

    txt = "You pressed Cancel!";

  }

  document.getElementById("demo").innerHTML = txt;

}

</script>


</body>

</html>


Write a program to Prompt Dilog Box using html JavaScript

 <html>

<body>


<h2>JavaScript Prompt</h2>


<button onclick="myFunction()">Click Me</button>


<p id="demo"></p>


<script>

function myFunction() {

  let text;

  let person = prompt("Please enter your name:", "Savera");

  if (person == null || person == "") {

    text = "User cancelled the prompt.";

  } else {

    text = "Hello " + person + "! How are you today?";

  }

  document.getElementById("demo").innerHTML = text;

}

</script>


</body>

</html>


Write a program to Confirm Dilog Box using html

 <html>

<body>

<h2>JavaScript Confirm Box</h2>

<button onclick="myFunction()">Click Me</button>

<p id="demo"></p>

<script>

function myFunction() {

  var txt;

  if (confirm("Press a button!")) {

    txt = "You pressed OK!";

  } else {

    txt = "You pressed Cancel!";

  }

  document.getElementById("demo").innerHTML = txt;

}

</script>

</body>

</html>


Write a program To Alert Box using html

 <html>

<body>

<h2>JavaScript Alert</h2>

<button onclick="myFunction()">CLick Me</button>

<script>

function myFunction() {

 alert("I am an alert box!");

}

</script>

</body>

</html>

Write a program to alert Dilox box in Javascript

 <HTML>

<HEAD>

<TITLE>ALERT BOX EXAMPLE</TITLE>

</HEAD>

<BODY>

<SCRIPT Language="JavaScript">

alert("Welcome to Our Website!!!");

document.write('<IMG SRC=""/>');

</SCRIPT>

</BODY>

</HTML>






Write a program to Prompt Dilog Box in Javascript

 <HTML>

<HEAD>

<TITLE>PROMPT BOX EXAMPLE</TITLE>

</HEAD>

<BODY>

<SCRIPT Language="JavaScript">

document.write("<h1>Greetings</h1>");

document.write(prompt("Enter Your Name: ", "Name"));

document.write(" Welcome to Our Site!</h1>");

</SCRIPT>

</BODY>

</HTML>



Data Science using Spreadsheet Software Assignment 3

Printing Workbooks select the cells you want to print and then set that area as the print area   Steps to set a print area: Select the cells...