[转]asp的textbox的javascript应用
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server"> </script>
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">
<title>无标题页</title>
<script language="javascript" type="text/javascript">
//javascript设置文本框的最大长度
function Button1_Click()
{
var txtBox1=document.getElementById("TextBox1");
txtBox1.maxLength=10;
return false;
}
//javascript设置文本框的属性为只读
function Button2_Click() {
var txtBox1=document.getElementById("TextBox1");
txtBox1.readOnly=true;
return false;
}
//javascript设置行数与文本框类型 //将<input type=text />改成<textarea /> //id号不变
function Button3_Click()
{
//移除TextBox1
var textBox1=document.getElementById("TextBox1");
var textBox1id=textBox1.id; //得到TextBox1的父元素
var parentE=textBox1.parentElement; parentE.removeChild(textBox1);
//创建新元素
TextArea var newTextBox1=document.createElement("<textarea />");
newTextBox1.id=textBox1id;
newTextBox1.name=textBox1id;
newTextBox1.rows=10;
parentE.appendChild(newTextBox1);
// parentE.insertBefore(newTextBox1,textBox1);
return false;
}
//javascript设置文本框的文本
function Button4_Click()
{
var txtBox1=document.getElementById("TextBox1");
txtBox1.value='中国。河北。保定。曲阳。王爱辉';
return false;
}
//javascript设置鼠标移过去显示文本
function Button5_Click()
{
var txtBox1=document.getElementById("TextBox1");
txtBox1.title='曲阳县第一中学';
return false;
}
//设置文本框的可见性 //可能是将TextBox1控件从dom树中删除
function Button7_Click()
{
var txtBox1=document.getElementById("TextBox1");
return false;
}
//javascript设置是否自动换行 //只对<textare />有效
function Button6_Click()
{ return false; }
</script>
</head>
<body>
<form id="form1" runat
相关文档:
自己写的一个简易计时器,能记算代码的执行时间,还可以拿来测试代码的执行效率。
function Counter(){
this.start();
}
Counter.prototype.getTime = function(){
var time = new Date();
return time.getSeconds()*1000+time.getMilliseconds();
}
Counter.prototype.start = function(){
this. ......
父窗口中有三种方式打开子窗口:
1:
window.open(URL,windowName,parameters);
2:
alert(""); //弹出信息提示对话框
confirm(""); //弹出信息确认对话框
prompt(""); //具有交互性质的对话框
3:
//创建模态你对话框
window.showModalDialog(sURL,vArguments,sFeatures)
//创建非模态对话框
window.showM ......
Marquee图片无缝滚动关键词: Marquee
先了解一下 ......
srcElement 是Dom事件中的事件最初指派到的元素。
比如有一个div,里面有一个按钮。你响应div的onclick事件,但实际上,你单击的只是它内部的按钮,那么,srcElement指向的,就是那个按钮。
srcElement只在IE中有效。
在Opera系列浏览器中对应的属性是target
给你一个IE下使用的例子。
<!DOCTYPE html PUBLIC "-//W ......
VBScript:
定义变量时候不能直接赋值,如:
Dim i=1 是错误的,应该这样:
Dim i
i = 1
——————————————
结束程序:response.end
跳出循环或者函数、子程序等用exit …
——————&m ......