当前位置: 首页 > 图文教程 > 网络编程 > Javascript > js常见表单应用技巧

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 js常见表单应用技巧


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 176 ::
收藏到网摘: n/a

显示框架内的指定位置 改变文本框的属性 改变文本框的属性 改变文本框的属性(下拉列表) 显示框架内的指定位置
<div style='width:300px;height:300px;'><iframe src='http://163.com' style='margin:-100px;width:100%;height:100%'></iframe></div>

改变文本框的属性(确定按钮)
<form id="form1" name="form1" method="post" action="">
<input name="text" type="text" value="sdafasdfasdf" id="name"/>
<input type="button" name="Submit" value="更改" onClick="tot()"/>
</form>
<SCRIPT LANGUAGE="JavaScript">
<!--
function tot()
{
if (document.form1.name.disabled == true)
{
document.all.name.disabled=false;
}
else
{
document.all.name.disabled=true;
}
}
//-->
</SCRIPT>

注:以下的readOnly的O必须为大写r必须为小写
<SCRIPT LANGUAGE="JavaScript">
<!--
function tot()
{
if (document.all.name.readOnly == true)
{
document.all.name.readOnly=false;
}
else
{
document.all.name.readOnly=true;
}
}
//-->
</SCRIPT>
改变文本框的属性(单选按钮)
<script language="javascript">
<!--
function cStyleshow()
{
document.all.name.disabled=false;
}
function cStylehidde()
{
document.all.name.disabled=true;
}
-->
</script>
<input name='a1' type='radio' value='yes' checked onclick='cStyleshow()'>1
<input name='a1' type='radio' value='no' checked onclick='cStylehidde()'>2

<input name="name" type="text" id="name">

改变文本框的属性(下拉列表)
<select name="s1" onChange="if(this.value==1){document.all('T1').readOnly=true}else{document.all('T1').readOnly=false}">
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="text" name="T1"/>