js常見(jiàn)表單應(yīng)用技巧
更新時(shí)間:2008年01月09日 13:42:29 作者:
顯示框架內(nèi)的指定位置 改變文本框的屬性 改變文本框的屬性 改變文本框的屬性(下拉列表)
顯示框架內(nèi)的指定位置
<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必須為大寫(xiě)r必須為小寫(xiě)
<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"/>
<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必須為大寫(xiě)r必須為小寫(xiě)
<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"/>
相關(guān)文章
javaScript 簡(jiǎn)單驗(yàn)證代碼(用戶名,密碼,郵箱)
下面的代碼包括了用戶名,密碼,郵箱的基本驗(yàn)證代碼,需要的朋友可以參考下。2009-09-09javaScript checkbox 全選/反選及批量刪除
javaScript checkbox 全選/反選及批量刪除實(shí)現(xiàn)代碼,需要的朋友可以參考下。2010-04-04js 獲取中文拼音,Select自動(dòng)匹配字母獲取值的代碼
漢字轉(zhuǎn)拼音,拼音首字母,select選擇按聲母過(guò)濾2009-09-09用javascript實(shí)現(xiàn)不按Ctrl實(shí)現(xiàn)Multiple Select多選
用javascript實(shí)現(xiàn)不按Ctrl實(shí)現(xiàn)Multiple Select多選...2007-08-08如何使頁(yè)面打開(kāi)時(shí)input就被選中?
如何使頁(yè)面打開(kāi)時(shí)input就被選中?...2007-02-02用javascript判斷輸入數(shù)據(jù)是否貨幣并自動(dòng)添加¥符號(hào)的代碼
用javascript判斷輸入數(shù)據(jù)是否貨幣并自動(dòng)添加¥符號(hào)的代碼...2007-08-08