get_focus() lost_focus() | How to Change Lower Case To Upper case when onclick() event occur

Start the program. Declare the get_focus() and lost_focus() event and when you type in the first text box then tab key. It call the function uppercase function. see the code uppercase() var x=document.getElementById("fname").value,document.getElementById("fname").value=x.toUpperCase(). It will change the lower case to Upper case. Finally terminate the program

Source in Html programing
<html>
<head>
<STYLE TYPE="text/css">
a:active
{
color:olive;
}</STYLE>
<Script TYPE="text/javascript">
function get_focus()
{
document.getElementById('back').focus();
}
function lost_focus()
{
document.getElementById('back').blur();
}
function uppercase()
{
var x=document.getElementById("fname").value
document.getElementById("fname").value=x.toUpperCase()
}
function set(x)
{
document.getElementById(x).style.background="yellow"
}
</script>
</head><body bgcolor="#ffe4c4">
<b style="text-family:verdona; color:blue;">Focus Event</b><br><br>
<a id ="back" HREF="main.html">
BACK</a><br><br>
<INPUT TYPE="button" onclick="get_focus()" value="GETFOCUS">
<INPUT TYPE="button" onclick="lost_focus()" value="LOSTFOCUS"><br><br>
<b style="text-family:verdona; color:blue;">Blur Event</b><br><br>
Enter your first name:
<input type="text" id="fname" onblur="uppercase()">
Last name:<input type="text" onfocus="set(this.id)" id="lname">
</body>


get_focus() lost_focus() change lowercase to uppercase onclick()

Post a Comment

0 Comments