-
Notifications
You must be signed in to change notification settings - Fork 0
/
flames.html
executable file
·133 lines (128 loc) · 3.14 KB
/
flames.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!--
FLAMES => F-Friend : L-Love : A-Affectionate : M-Marriage : E-Enemy : S-Sister
Developed by V.Ramachandran on 20-12-2010(Monday).
Developed using HTML and JavaScript.
-->
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="colorchange.js"></script>
<script type="text/javascript">
first_array = new Array();
second_array = new Array();
final_string = new Array();
function compare(form)
{
name1 = form.fname.value;
name2 = form.sname.value;
first_array = name1.toLowerCase().replace(/ /gi,"").split('');
second_array = name2.toLowerCase().replace(/ /gi,"").split('');
for(i in first_array){
for(j in second_array){
if((first_array[i] == second_array[j]) && (first_array[i]!='') && (second_array[j]!=''))
{
first_array[i] = '';
second_array[j] = '';
}
}
}
for(i=0; i<=first_array.length; i++)
{
if(first_array[i]=='')
{
first_array.splice(i,1);
}
}
for(j=0; j<=second_array.length; j++)
{
if(second_array[j]=='')
{
second_array.splice(j,1);
}
}
final_string = first_array.toString().replace(/,/gi,"") + second_array.toString().replace(/,/gi,"");
l = final_string.length;
result(l);
}
function result(n)
{
string = "flames";
number = n;
process = new Array();
while(string.length>=2)
{
var j=0;
process = [];
position = number%string.length;
if(position!=0)
{
for(i=position+1; i<=string.length; i++)
{
process[j] = string.charAt(i-1);
j++;
}
for(i=0; i<=position-2; i++)
{
process[j] = string.charAt(i);
j++;
}
string = process.toString().replace(/,/gi,"");
}
else
{
string = string.slice(0,-1);
}
}
display(string);
}
function display(s)
{
if(s=='f')
{
document.getElementById("result").innerHTML="The Relationship between "+name1+" and "+name2+" is Friend";
}
if(s=='l')
{
document.getElementById("result").innerHTML="The Relationship between "+name1+" and "+name2+" is Love";
}
if(s=='a')
{
document.getElementById("result").innerHTML="The Relationship between "+name1+" and "+name2+" is Affectionate";
}
if(s=='m')
{
document.getElementById("result").innerHTML="The Relationship between "+name1+" and "+name2+" is Marriage";
}
if(s=='e')
{
document.getElementById("result").innerHTML="The Relationship between "+name1+" and "+name2+" is Enemy";
}
if(s=='s')
{
document.getElementById("result").innerHTML="The Relationship between "+name1+" and "+name2+" is Sister";
}
}
function clr(form)
{
form.fname.value="";
form.sname.value="";
document.getElementById("result").innerHTML="";
}
</script>
</head>
<body bgcolor="FFFFE0">
<center>
<div id="color"><h1>FLAMES</h1></div>
<form>
<br>
<font color="blue">Enter First Name:</font>
<input type="text" name="fname" onKeyUp="compare(this.form)"><br><br>
<font color="blue">Enter Second Name:</font>
<input type="text" name="sname" onKeyUp="compare(this.form)"><br><br>
<input type="button" name="b1" value="Submit" onClick="compare(this.form)">
<input type="button" name="b2" value="Clear" onClick="clr(this.form)"><br><br>
</form>
<div id="result"></div>
</center>
</body>
</html>