Javascript basic tutorial cursor gathering event

onfocus Cursor gathering event

Let’s write an example of cursor gathering event

The code is as follows:

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>光标聚集事件</title>
</head>
<body>
	<form>
	来自:<select  name="op" onfocus="onf()">
			<option>安徽</option>
			<option>池州</option>
			<option>安庆</option>
			<option>六安</option>
			<option>阜阳</option>
		</select>
	</form>

	<script type="text/javascript">
			function onf(){
				alert('请选择,您来自哪里');
			}
	</script>
</body>
</html>


Continuing Learning
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>光标聚集事件</title> </head> <body> <form> 来自:<select name="op" onfocus="onf()"> <option>安徽</option> <option>池州</option> <option>安庆</option> <option>六安</option> <option>阜阳</option> </select> </form> <script type="text/javascript"> function onf(){ alert('请选择,您来自哪里'); } </script> </body> </html>
submitReset Code