if (IsPostBack == false)
{
Button5.Attributes.Add("onclick", "return check();");
}
---------------------------------<SCRIPT language="javascript">
function check()
{
if(confirm('aa'))
{
document.Form1.Select1.style.visibility = false; // 为什么这一句没有效果还是没有执??
document.Form1.Select1.add("aa"); // 有效果
return true;
}
else
{
return false;
}
}</SCRIPT>
{
Button5.Attributes.Add("onclick", "return check();");
}
---------------------------------<SCRIPT language="javascript">
function check()
{
if(confirm('aa'))
{
document.Form1.Select1.style.visibility = false; // 为什么这一句没有效果还是没有执??
document.Form1.Select1.add("aa"); // 有效果
return true;
}
else
{
return false;
}
}</SCRIPT>
document.all("Select1")..add("aa");
document.Form1.Select1.add("aa"); // 有效果
---------------
var sel = document.getByElementById("selID");
sel.style.visibilibty = false;var oOption = document.createElement("OPTION");
oOption.text="法拉利";
oOption.value="4";sel.add(oOption);
sel.style.display= 'none';var oOption = document.createElement("OPTION");
oOption.text="法拉利";
oOption.value="4";sel.add(oOption);
--------------------------------
谢谢如何让他显示呢 ?sel.style.display= 'yes'; 不行
sel.style.visibility="hidden"or:
sel.style.display="block"
sel.style.visibility="visible"
sel.style.visibilibty = false;----------------更正为:
sel.style.visibilibty = hidden;//显示用visible
Button5.Attributes.Add("onclick", "check();");
--------------------------------------
function check()
{
//document.Form1.Text1.value = "dfdf_true";
if (document.Form1.Text1.style.display == "none")
{
document.Form1.Text1.style.display = "";
}
else
{
document.Form1.Text1.style.display = "none";
}
}上面这些方法,效果是出现了,但是感觉按钮事件像是被执行了两次 !结果效果一闪而过,
???
在Button5的click事件中添加:
string script=@"<script>
//document.Form1.Text1.value = 'dfdf_true';
if (document.Form1.Text1.style.display == 'none')
{
document.Form1.Text1.style.display = '';
}
else
{
document.Form1.Text1.style.display = 'none';
} </script>";
RegisterStartupScript(DateTime.Now.ToString(), script);