一、一个单行文本框的例子

<form name="form1" action="mailto:3400982550@qq.com" method="post" enctype="text/plain">
<p>您的姓名: <input type="text" name="text1" size="12" maxlength="20">
您的E_mail: <input type="text" name="text2" size="20" maxlength="24" value="*****@*.*">
输入口令: <input type="password" name="text3" size="8" maxlength="8"> </p>
<p align="center">
<input type="submit" name="提交" value="提 交">
<input type="reset" name="重写" value="重 写">
</p>
</form>

二、检验用户输入的信息

<script language="javascript">
<!--
function test(form){
test1(form);
test2(form);
test3(form)}
function test1(form){
if (form.text1.value=="")
alert("你没有写上你的姓名,请输入姓名!")
}
function test2(form){
if (form.text2.value==""||form.text2.value.indexOf('@',0)==-1)
alert("E_mail地址不正确,请重新输入!")
}
function test3(form){
if (form.text3.value!="12345678")
alert("密码错误,请重新输入!")
}
-->
</script>

三、制作一个留言簿

<form name="form2" action="mailto:fyy0528@sina.com" method="post" enctype="text/plain" >
<table width="50%" border="1" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#CCFFCC" cellpadding="4" align="left">
<tr>
<td colspan="2"> <div align="center"><b>留 言 簿</b></div> </td>
</tr>
<tr>
<td>姓名: <input type="text" name="textfield" size="8"> </td>
<td>E_mail: <input type="text" name="textfield2" size="10" maxlength="20"> </td>
</tr>
<tr>
<td colspan="2"> <div align="center">留 言<br> <textarea name="textfield3" cols="30" rows="3"></textarea>
</div>
</td>
</tr>
<tr>
<td> <div align="right"> <input type="submit" name="Submit" value="提 交"> </div> </td>
<td> <input type="reset" name="Submit2" value="重 写"> </td>
</tr>
</table>
</form>

html文本框参考样式

输入框景背景透明:

<input style="background:transparent;border:1px solid #ffffff">

鼠标划过输入框,输入框背景色变色:

<INPUT value="Type here" NAME="user_pass" TYPE="text" SIZE="29" onmouseover="this.style.borderColor='black';this.style.backgroundColor='plum'"
style="width: 106; height: 21"
onmouseout="this.style.borderColor='black';this.style.backgroundColor='#ffffff'" style="border-width:1px;border-color=black">

输入字时输入框边框闪烁(边框为小方型):

<Script Language="JavaScript">
function borderColor(){
if(self['oText'].style.borderColor=='red'){
self['oText'].style.borderColor = 'yellow';
}else{
self['oText'].style.borderColor = 'red';
}
oTime = setTimeout('borderColor()',400);
}
</Script>
<input type="text" id="oText" style="border:5px dotted red;color:red" onfocus="borderColor(this);" onblur="clearTimeout(oTime);">

输入字时输入框边框闪烁(边框为虚线):

<style>
#oText{border:1px dotted #ff0000;ryo:expression_r(onfocus=function light (){with(document.all.oText){style.borderColor=(style.borderColor=="#ffee00"?"#ff0000":"#ffee00");timer=setTimeout(light,500);}},onblur=function(){this.style.borderColor="#ff0000";clearTimeout(timer)})};
</style>
<input type="text" id="oText">

自动横向廷伸的输入框:

<input type="text" style="huerreson:expression_r(this.width=this.scrollWidth)" value="abcdefghijk">

自动向下廷伸的文本框:

<textarea name="content" rows="6" cols="80" onpropertychange="if(this.scrollHeight>80) this.style.posHeight=this.scrollHeight+5">输入几个回车试试</textarea>

只有下划线的文本框:

<input style="border:0;border-bottom:1 solid black;background:;">

html文本框常见操作技巧

1、html文本框怎么用css变圆角
 

border-radius属性可以实现元素的圆角。如下css可以实现文本框(单行、多行)的圆角:
input[type=text],textarea{border-radius:3px;border:1px solid #000;}

border-radius用法如下:
border-radius 属性是一个简写属性,用于设置四个 border-*-radius 属性。
该属性允许为元素添加圆角边框
语法:

border-radius: 1-4 length|% / 1-4 length|%;

按此顺序设置每个 radius 的四个值。
如果省略 bottom-left,则与 top-right 相同。
如果省略 bottom-right,则与 top-left 相同。
如果省略 top-right,则与 top-left 相同。
单位一般用px和百分比较多,其他单位也可

2、HTML中如何设置文本框的大小

边框的大小,可以使用CSS样式控制,如:
<textarea id="txtCon" >content</textarea>
<style type="text/css">
#txtCon{width:100px; height:20px;}
</style>

也可以使用文本框自己的属性,定义文本框的行和列控制大小,如:
<textarea id="txtCon" rows="100" cols="100" >content</textarea>

3、在html中如何实现将本网页中文本框中的值传递到另一个网页的用户名密码框中,并实现登陆

在html网页中,一个按钮,两个文本框,在<SCRIPT language=JavaScript> /SCRIPT>当中如何写代码能够实现将这两个文本框中的值传递到另一个制定地址的网页中的用户名和密码处,并实现登陆?

页面必须是跳转过去的才行。例如另一个页面是page.html那么你跳转的时候 page.html?username=tony&password=123 跳转到这个地址,

然后到另一个页面的时候在脚本里面写
<SCRIPT language=JavaScript>
var url = window.location.href;
然后var username = url.split("?")[1].split("&")[0].split("=")[1] //这样就获取到用户名了。
var password = url.split("&")[1].split("=")[1];

然后把值赋给你的密码文本框
document.getElementById("txtpassword").value = password;
document.getElementById("txtusername").value=username;
< /SCRIPT>

然后验证用户名和密码就可以了。

4、HTML中让表单input等文本框为只读不可编辑的方法

有时候,我们希望表单中的文本框是只读的,让用户不能修改其中的信息,如使<input type="text" name="input1" value="中国"> 的内容,"中国"两个字不可以修改。实现的方式归纳一下,有如下几种。

方法1: onfocus=this.blur() 当鼠标放不上就离开焦点
<input type="text" name="input1" value="中国" onfocus=this.blur()>

方法2:readonly 
<input type="text" name="input1" value="中国" readonly> 
<input type="text" name="input1" value="中国" readonly="true">

方法3: disabled 
<input type="text" name="input1" value="中国" disabled="true">

完整的例子:

<input name="ly_qq" type="text" tabindex="2" onMouseOver="this.className='input_1'" onMouseOut="this.className='input_2'" value="123456789" disabled="true" readOnly="true" />

disabled="true" 此果文字会变成灰色,不可编辑。 
readOnly="true" 文字不会变色,也是不可编辑的

css屏蔽输入:<input style="ime-mode: disabled">

有两种方法第一:disabled="disabled"这样定义之后被禁用的 input 元素既不可用,也不可点击。第二:readonly="readonly" 只读字段是不能修改的。不过,用户仍然可以使用 tab 键切换到该字段,还可以选中或拷贝其文本;

html---文本框样式;的更多相关文章

  1. UITextField常用属性归纳:文本框样式、文字样式、键盘样式、左右视图样式、清除按钮设置等

    (1)可以根据需要设置文本框的样式(包括形状.边框颜色.背景等). (2)可以根据需要设置文字显示样式(包括输入密码时的密文显示.文字横向居中.纵向居中上下.输入的文字是否首席木大写.文字超过后是否缩 ...

  2. 最好的文本框样式 最漂亮的文本框样式 textbox css样式

    输入框景背景透明: <input style="background:transparent;border:1px solid #ffffff"> 鼠标划过输入框,输入 ...

  3. HTML文本框样式大全

    粘贴自Christian.Cao 博客园地址 : https://www.cnblogs.com/QQ862668193/p/6893797.html 输入框景背景透明:<input style ...

  4. HTML实用文本框样式

    输入框景背景透明: <input style="background:transparent;border:1px solid #ffffff"> 鼠标划过输入框,输入 ...

  5. css ul dl dt 表格分页 文本框样式

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  6. jQuery 文本框得失焦点应用

    一.文本框得失焦点一种是改变文本框的样式    得到焦点:               失去焦点: 二.文本框得失焦点另一种是改变文本框的值    得到焦点:     失去焦点:       三.jQ ...

  7. HTML文本框

    文本框样式大全   输入框景背景透明:<input style="background:transparent;border:1px solid #ffffff"> 鼠 ...

  8. 文本框input:text

      文本框 CreateTime--2017年4月24日10:40:40 Author:Marydon 一.文本框 (一)标签 <input type="text"/> ...

  9. 目录视图摘要视图订阅 基于Extjs开发不允许为空的文本框提示及相应的验证错误提示(转)

    原文地址:http://blog.csdn.net/kunoy/article/details/8007585 本文主要解决问题: 1.区分哪些文本框不允许为空,很多网站都采用在文本框后加*号,ext ...

  10. [转]让你的网页文本框增加光晕效果与提示,水印(类似QQ2011)

    本文转自:http://www.cnblogs.com/xiaofengfeng/archive/2013/01/28/2880344.html 让你的网页文本框增加光晕效果(类似QQ2011) 我们 ...

随机推荐

  1. 继承自NSObject的类不能用CGRect

    我用的是Xcode6.2. 系统默认没有pch文件. 所以没有自动导入UIKit包. 我在继承NSObject类里也不能用CGRect或者UI开头的控件,原因也是Xcode6.2以后版本 缺少UIKi ...

  2. 踏着前人的脚印学Hadoop——结构、重点

    HDFS作为一个分布式文件系统,是所有这些项目的基础.分析好HDFS,有利于了解其他系统.由于Hadoop的HDFS和MapReduce是同一个项目,我们就把他们放在一块,进行分析. 如果把整个had ...

  3. ubuntu 添加源

    edit file :  /etc/apt/sources.list add: deb http://mirrors.163.com/ubuntu/ intrepid main restricted ...

  4. URL详谈

    URL(Uniform Resource Locator,统一资源定位符)是地址的别名.它包含关于文件存储位置和浏览器应如何处理它的信息.互联网上的每个文件都有唯一的 URL. URL 的第一个部分称 ...

  5. hdu3911 线段树 区间合并

    //Accepted 3911 750MS 9872K //线段树 区间合并 #include <cstdio> #include <cstring> #include < ...

  6. Vijos 1243 生产产品 (单调队列优化的动态规划)

    题意:中文题.不说了. 注意一些地方,机器的执行过程是没有顺序的,而且每个机器可以用多次.第一次执行的机器不消耗转移时间K. 用dp[i][j]表示第i个机器完成第j个步骤的最短时间,sum[j][i ...

  7. WPF制作子窗体的弹出动画效果

    创建一个WPF应用程序WpfApplication1,新建个窗体DialogWin <Windowx:Class="WpfApplication1.DialogWin" xm ...

  8. php大力力 [011节] PHP常量使用场景

    2015-08-24 php大力力011. PHP常量使用场景 $root = "dali"; define("ROOT",10) echo "ROO ...

  9. MVC中Asp.Net管道(二)

    Asp.Net管道: 1.在工作进程w3wp.exe中,利用asp.net_isapi加载.NET运行时,6.0中引入了应用程序池的概念,一个工作进程对应的一个应用程序池.一个应用呢程序池可以加载一个 ...

  10. IOS 用正则表达式解析HTML等文件,得到所有文本

    获得网页内容 NSURL *url=[NSURL URLWithString:@"http://121.199.34.52/wordpress/?json=core.get_post_con ...