0% found this document useful (0 votes)
52 views

Css 4

This document contains code snippets demonstrating different uses of functions in JavaScript. The first defines a function called "disp" that uses document.write to output the string "hello_world" when an onclick event is triggered. The second defines a function called "disp" that takes a parameter "r", prompts the user to input a radius, calculates the area of a circle using that radius, and outputs the result. The third defines a function called "disp" that returns the string "welcome to gramin" without using document.write, instead calling the function directly in the document.write statement.

Uploaded by

ayush
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Css 4

This document contains code snippets demonstrating different uses of functions in JavaScript. The first defines a function called "disp" that uses document.write to output the string "hello_world" when an onclick event is triggered. The second defines a function called "disp" that takes a parameter "r", prompts the user to input a radius, calculates the area of a circle using that radius, and outputs the result. The third defines a function called "disp" that returns the string "welcome to gramin" without using document.write, instead calling the function directly in the document.write statement.

Uploaded by

ayush
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Name:- Ayush Maroti Wadje Roll No:-76 Class:-CO5I

Code:
<!DOCTYPE html>
<html>
<head>
<input type="button" value="click me" onclick="disp()">
<title>Function in js</title>
<script type="text/javascript">
function disp() {
document.write("hello_world");
}
</script>
</head>
</html>
Code:
<html>
<h1> Funtion with args</h1>
<input type="button" value="click me" onclick="disp(r)">
<script type="text/javascript">
var r=prompt("enter the radius");

function disp(r)
{
var a;
a = 3.14 * r * r ;
document.write(a);
}
</script>
</html>
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
function disp() {
return "welcome to gramin";
}
document.write(disp());
</script>
</head>
</html>

You might also like