-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.html
More file actions
128 lines (105 loc) · 3.12 KB
/
function.html
File metadata and controls
128 lines (105 loc) · 3.12 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<p id="ja"></p>
<button onclick="getData('John','27', 'Male')">Get Data</button>
<script>
function getData(name, age, gender){
//document.write(name + ' is ' + age + ' years old. He is a ' + gender + '.');
document.getElementById('ja').innerHTML = name + ' is ' + age + ' years old. He is a ' + gender + '.'
}
</script>
<br/><br/>
<button onclick="matchTeam()">Concatenate Function</button>
<script>
function team(team1, team2){
var team;
team = team1 + ' V/S ' + team2;
return team;
}
function matchTeam(){
var matchT;
matchT = team('India', 'Australia');
//return matchT;
document.getElementById('ja').innerHTML = matchT;
}
</script>
<br/><br/>
<button onclick="getFullName()">Get Full Name</button>
<script>
var first = 'John';
var last = 'Shaw';
var full = function(){
return this.first + ' ' + this.last;
}
function getFullName(){
document.getElementById('ja').innerHTML = full();
}
</script>
<br/><br/>
<button onclick="getFullName2()">Get Full Name 2</button>
<script>
function getFullName2(first2, last2){
first2 = 'Doe';
last2 = 'Singh';
document.getElementById('ja').innerHTML = first2 + ' ' + last2;
}
</script>
<br/><br/>
<button onclick="getMovieName()">Concatenate Function2</button>
<script>
function getMovie(morning, evening, night){
var showM = morning + ' ' + evening + ' ' + night;
return showM;
}
function getMovieName(){
var movie = getMovie('Dangal', 'Wanted', 'Bahubali');
document.getElementById('ja').innerHTML = movie;
}
</script>
<br/><br/>
<button onclick="getDinnerL()">Concatenate Function3</button>
<script>
var dinner;
function getDinnerL(startar, maain, desert){
dinner = startar + maain + desert;
return dinner;
}
document.getElementById('ja').innerHTML = getDinnerL('a', 'b', 'c');
</script>
<br/><br/>
<button onclick="redirectPage()">Redirect</button>
<script>
function redirectPage(){
//window.location.href = 'https://www.google.co.in/';
window.open('https://www.google.co.in/', '_blank');
}
/*(function(){
window.open('https://www.google.co.in/', '_blank');
})();*/
</script>
<br/><br/>
<button onclick="autoRedirectPage()">Auto Redirect</button>
<script>
function autoRedirectPage(){
window.open('https://www.google.co.in/', '_blank');
}
//setTimeout('autoRedirectPage()', 1000);
</script>
<br/><br/>
<button onclick="browserRedirect()">Browser Redirect</button>
<script>
function browserRedirect(){
var brRd = navigator.userAgent;
alert(brRd);
}
</script>
<br/><br/>
<button onclick="window.print()">Print Page</button>
</body>
</html>