Program of equal and unequal strings in JS Javascript with form values by user user and with flowchart

Program of equal and unequal strings in JS Javascript with form values by user user and with flowchart

In this tutorial, we will learn the followings;

  1. Flowchart of Program of equal and unequal strings.
  2. Program of equal and unequal strings.
  3. Program of equal and unequal strings with form values by user user.

Flowchart of Program of equal and unequal strings.

program equal and unequal strings in JS Javascript form values user
Figure: program equal and unequal strings in JS Javascript form values user

Program of equal and unequal strings.\

<!DOCTYPE html>
<html>
<body>
<p>Cliick The Button to Compare The Strings.</p>

<button onclick="f1()">Try it</button>

<p id="c"></p>
<script>
function f1() {
    var a = "ab";
    var b = "ab";
    if(a==b)
	{
		document.getElementById("c").innerHTML = "Equal";
		}
    else
	{
		document.getElementById("c").innerHTML = "Not Equal";
		}
}
</script>

</body>
</html>

Program of equal and unequal strings with form values by user user.

<!DOCTYPE html>
<html>
<body>

<p>Cliick The Button to Compare The Strings.</p>
<input id="i1">Enter First String</br>
<input id="i2">Enter Second String</br>
<button onclick="f1()">Try it</button>

<p id="d">Answer Here</p>

<script>
function f1() {
    var s1,s2;
    s1=document.getElementById("i1").value;
	s2=document.getElementById("i2").value;
    if(s1==s2)
	{
		document.getElementById("d").innerHTML ="Equal";
		}
    else
	{
		document.getElementById("d").innerHTML ="Not Equal";
		}
}
</script>

</body>
</html>


 
List of All Programs of Javascript : Click Here 
.

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.