如何在函数中传递一个对象的名字,然后对其进行操作? document.getElementsByName('ttt')[0].style.display="none"; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function fun(name){ document.getElementsByName(name)[0].style.display="none";}then callfun('ttt'); function funct(a){ alert(a); document.getElementsByName(a)[0].style.display="none"; }function funct2(a){ alert(a); document.getElementsByName(a)[0].style.display=""; }<input type="text" name="txt111"><input type="button" name="btn1" value="aaa" onclick="funct('txt111')"><input type="button" name="btn2" value="bbb" onclick="funct2('txt111')"> <FORM METHOD=POST ACTION=""><TEXTAREA NAME="ttt" ROWS="" COLS=""></TEXTAREA><br><input type="button" name="button" value="hid" onclick="fun(this, this.form.ttt)"></FORM><SCRIPT LANGUAGE="JavaScript"><!--function fun(s, e) { if (e.style.display == ""){ e.style.display = "none"; s.value = "show" } else { e.style.display = ""; s.value = "hid" }}//--></SCRIPT> 简单版的:<FORM METHOD=POST ACTION=""><TEXTAREA NAME="ttt" ROWS="" COLS=""></TEXTAREA><br><input type="button" name="button" value="show and hidden" onclick="fun(this.form.ttt)"></FORM><SCRIPT LANGUAGE="JavaScript"><!--function fun(e) { e.style.display = e.style.display == "" ? "none" : "";}//--></SCRIPT> highcharts中怎么调整第一个数据的宽度 JS如何捕获图片SRC 在线等 xml解析问题不明白求教 获得iframe中的iframe中的div个数 怎样写字符间的循环语句? jquery设置div背景图 请问,<script language=javascript.encode>...</script>之间的内容怎样取得?谢谢! 问题不难,急死人了? Javascript与Jscript是不是一样的? 求大神,这句JS不太懂 关于超链接的问题 top 怎么是0
document.getElementsByName(name)[0].style.display="none";
}then call
fun('ttt');
alert(a);
document.getElementsByName(a)[0].style.display="none";
}
function funct2(a){
alert(a);
document.getElementsByName(a)[0].style.display="";
}<input type="text" name="txt111">
<input type="button" name="btn1" value="aaa" onclick="funct('txt111')">
<input type="button" name="btn2" value="bbb" onclick="funct2('txt111')">
<TEXTAREA NAME="ttt" ROWS="" COLS=""></TEXTAREA><br>
<input type="button" name="button" value="hid" onclick="fun(this, this.form.ttt)">
</FORM>
<SCRIPT LANGUAGE="JavaScript">
<!--
function fun(s, e) {
if (e.style.display == ""){
e.style.display = "none";
s.value = "show"
} else {
e.style.display = "";
s.value = "hid"
}
}
//-->
</SCRIPT>
<TEXTAREA NAME="ttt" ROWS="" COLS=""></TEXTAREA><br>
<input type="button" name="button" value="show and hidden" onclick="fun(this.form.ttt)">
</FORM>
<SCRIPT LANGUAGE="JavaScript">
<!--
function fun(e) {
e.style.display = e.style.display == "" ? "none" : "";
}
//-->
</SCRIPT>