用于显示按钮和文件上载控件的javascript代码 [英] javascript code for showing button and fileupload control
问题描述
我已经在加载事件中将fileupload和按钮设置为可见false。然后我将button1保持为true。当用户点击button1时,它应该显示隐藏的文件上传和按钮。
我只需要javascript代码来满足这些要求。我这样做但没有工作
function show()
{
document.getElementById(< span class =code-string>' button')。style.visibility = ' visible';
document.getElementById(' fileupload')。style.visibility = ' visible';
}
试试这个:
< 按钮 id = 按钮 style = visibility:hidden; > 按钮< / button > < br / >
< 输入 类型 = file id = fileupload style = visibility:hidden; / >
< br / >
< 按钮 id = button1 onclick = show() > 显示< / button >
< script >
function show()
{
document.getElementById('button')。style.visibility ='visible';
document.getElementById('fileupload')。style.visibility ='visible';
}
< / script >
如果你正在设置fileupload和按钮在代码后面显示为false然后设置属性可见性:隐藏不可见:false
希望它有效...
< blockquote>将两个按钮保持在Div标签内。
在客户端上单击Button1只需将一个CSS类(带有属性Display:Block)分配给Div标签。
这是不可能的,因为在服务器端具有属性Visible = false的控件将不会在客户端呈现,并且无法在javascript中访问。
要完成您的要求,请在Page_Load活动中写下
protected void Page_Load( object sender,EventArgs e)
{
fileupload.Attributes.Add( display, none);
button.Attributes.Add( display, none);
}
// IN JAVASCRIPT:
function show()
{
document.getElementById(' button')。style.display = ;
document.getElementById(' fileupload')。style.display = ;
}
i have done fileupload and button set to visible false in load event.Then i kept button1 visible true. when user clicks the button1 it should show the hidden fileupload and button.
i need only javascript code for these requirements . I have done like this but not working
function show()
{
document.getElementById('button').style.visibility='visible';
document.getElementById('fileupload').style.visibility='visible';
}
Hi,
try this :
<button id="button" style="visibility:hidden;" > button</button><br/> <input type="file" id="fileupload" style="visibility:hidden;" /> <br/> <button id="button1" onclick="show()">Show </button> <script> function show() { document.getElementById('button').style.visibility='visible'; document.getElementById('fileupload').style.visibility='visible'; } </script>
If you are setting fileupload and button to visible false in code behind then set property visibility:hidden not visible: false
Hope it works ...
Keep both the buttons inside a Div tag.
On Client click of the Button1 Just assign a CSS class(with attribute Display:Block) to the Div tag.
It's Not possible, because controls which have Property "Visible = false" on server end will not render on client end and can not be accessed in javascript.
To complete your requirment write this on "Page_Load" event
protected void Page_Load(object sender, EventArgs e) { fileupload.Attributes.Add("display", "none"); button.Attributes.Add("display", "none"); }
// IN JAVASCRIPT: function show() { document.getElementById('button').style.display = ""; document.getElementById('fileupload').style.display = ""; }
这篇关于用于显示按钮和文件上载控件的javascript代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!