<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>文本框放大</title>
<script>
function $(id){
return document.getElementById(id);
} function showBigInfo(obj){
var bigObj;
if(!$("bigInfo")){
bigObj=document.createElement("span");
bigObj.setAttribute("id","bigInfo");
bigObj.style.position="absolute";
bigObj.style.border="1px solid #F93";
bigObj.style.borderRadius="2px";
bigObj.style.color="red";
bigObj.style.fontSize="26px";
bigObj.style.fontWeight="bold";
bigObj.style.padding="4px";
bigObj.style.display="none";
document.body.appendChild(bigObj);
obj.onblur=function(){
$("bigInfo").style.display="none";
}
obj.onfocus=function(){
$("bigInfo").style.display="block";
}
}else{
bigObj=$("bigInfo");
}
bigObj.style.display="block";
var str="";
var info=obj.value;
for(var i=;i<info.length;i+=){
str+=info.substr(i,)+" ";
}
bigObj.innerHTML=str;
if(obj.offsetTop<){ //放大框在下方显示
bigObj.style.top=(obj.offsetTop+obj.offsetHeight+)+"px";
}else{ //放大框在上方显示
bigObj.style.top=(obj.offsetTop-bigObj.offsetHeight-)+"px";
}
bigObj.style.left=(obj.offsetLeft+obj.offsetWidth/-bigObj.offsetWidth/)+"px";
}
</script>
</head> <body>
<br /><br /><br /><br /><br /><br />
<center> 请输入身份证号码:<input type="password" onKeyUp="showBigInfo(this)" maxlength="" size=""/>
<br />
请输入身份证号码:<input type="password" onKeyUp="showBigInfo(this)" maxlength="" size=""/>
<br />
请输入身份证号码:<input type="password" onKeyUp="showBigInfo(this)" maxlength="" size=""/> </center>
</body>
</html>
相关文章
- Vue中如何实现点击按钮显示内容,点击内容或内容之外的区域隐藏内容
- HTML中让表单input等文本框为只读不可编辑但可以获取value值的方法;让文本域前面的内容显示在左上角,居中 - Chen_s
- 实战案例1:实现单选按钮及在文本框中展示选中的按钮内容
- Winform主菜单两种实现方式-1.)从工具箱中双击MenuStrip控件,窗体的顶部就会放置一个MenuStrip控件,或者在工具箱中单击MenuStrip控件,拖至窗体中也可以. 2.)在MenuStrip的“Type Here”输入主菜单和菜单名字,热键用(&X)表示. 用快捷键选择主菜单,可以用Alt + 预定义的按键来实现,子菜单的选择只需要按定义的热键即可. 3.)双击File*菜单下面的子菜单,创建子菜单Open、Save、Exit的单击事件代码: private void OpenOToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog { //初始化打开对话框的路径 InitialDirectory = @"D:\", Title = "Open File", //定义可显示的文件类型; Filter = "txt file(*.txt)|*.txt|All file(*.*)|*.*", //定义默认显示的文件类型为txt FilterIndex = 1, //对话框关闭后将复位初始化路径 RestoreDirectory = true }; if (ofd.ShowDialog == DialogResult.OK) { //根据打开对话框选择的文件名,加载文本内容到富文本框中. richtxtContent.Text = File.ReadAllText(ofd.FileName); } } private void SaveSToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog { //初始化保存对话框的路径 InitialDirectory = @"D:\", Title = "Save File", //定义可显示的文件类型; Filter = "txt file(*.txt)|*.txt|All file(*.*)|*.*", //定义默认显示的文件类型为txt FilterIndex = 1, //对话框关闭后将复位初始化路径 RestoreDirectory = true }; if(sfd.ShowDialog == DialogResult.OK) { //保存文件 File.WriteAllText(sfd.FileName, richtxtContent.Text); //清空富文本框内容 richtxtContent.Clear; } } private void exitEToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit; } 4.)执行下程序,加载指定的txt文件到富文本框中,如下: 5.)在富文本框中更新加载进来的txt文件内容. 6.)Alt + F热键打开文件的下拉菜单,单击S保存富文本框中的内容到指定的文件.打开txt验证菜单单击事件保存文件成功. 二.实现winform主菜单的方法2:MenuStrip类和toolStripMenuItem类实例化对象,在主窗体加载事件中实现如下代码:
- 网页中上传Excel文档并实时读取某一列的内容,显示出来的Js实现
- js实现html表格
标签中带换行的文本显示出换行效果 - 一個未来 - js实现文本框中内容的放大显示
- vue实现实时监听文本框内容的变化(最后一种为原生js)
- Js控制显示、隐藏文本框中的密码
- Jquery中复选框选中取消实现文本框的显示隐藏