postheadericon 7. Write a JavaScript to convert Celsius to Fahrenheit.




<html>
<head>
<title>EX-7: WTAD : www.bipinrupadiya.com</title>
<script type="text/javascript">
function convert(a)
{
var F=(a-32) * 5 / 9;
document.getElementById("far").innerHTML=a + ' Celsius = ' + F + ' Farenheit';
}
</script>
</head>
<body>
<br>Enter Celsius : <input type="text" id="txt" onkeyup="convert(this.value)">
<div id="far"></div>
</body>
</html>

2 comments:

Kale Co Jakim said...

The example is a simple demonstration of handling user input and performing a Celsius-to-Fahrenheit conversion dynamically with JavaScript. The onkeyup event calls the convert() function whenever the input changes, while getElementById() updates the result displayed on the page. A Javascript Course in Chennai can help learners practice these fundamentals through similar interactive exercises.

Kale Co Jakim said...

This exercise also introduces the connection between HTML elements and JavaScript functions, showing how user-entered values can be processed immediately and presented back in the browser. Small programs like this are useful for developing confidence with event handling, variables, functions, and DOM manipulation through Javascript Training in Chennai.

Blog Archive

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.