如何在HTML代码中添加/删除评论运行时? [英] how do i add/remove comment Run time in HTML Code?
本文介绍了如何在HTML代码中添加/删除评论运行时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想停止动态渲染客户端控件并停止播放诗句,
如:
首先我有
I want to stop rendering of a client side control dynamically and visa verse,
Such like:
first I have
<html>
<body>
<!-- <my control="" /> -->
<input type="submit" value="submit"/>
</body>
</html>
在单击按钮后,我需要执行以下操作:
And I need following after button click:
<html>
<body>
<my control="" />
<input type="submit" value="submit"/>
</body>
</html>
推荐答案
为什么不使用Java脚本尝试使用它?
使用Javascript动态添加和删除HTML元素 [ ^ ]
Why you are not trying it using Java Script ?
Add and Remove HTML elements dynamically with Javascript[^]
您可以使用javascript,只需创建一个函数
You can use javascript for that, just make a function
function Display()
{
document.getElementById('showcontrol').style.display = 'block';
}
然后点击按钮,就像这样
and call that on button click, like this
<html>
<body>
<my id="showcontrol" control="" style="display: none;" />
<input type="submit" value="submit" önclick="Display()" />
</body>
</html>
[更新]
试试这个:
[UPDATE]
try this:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--Hide from old browsers
var i=0,j=0;
var t1= new Array();
function createtext(){
i++;
t1[i]=document.createElement('input');
t1[i].type='text';
t1[i].name='text'+i;
t1[i].value = "hello";
t1[i].size = 10;
document.forms[0].appendChild(t1[i]);
var mybr=document.createElement('<br>');
document.appendChild(mybr);
}
</SCRIPT>
</HEAD>
<BODY >
<form action="" method="get" name="f1">
<input name="b1" type="button" onClick="createtext()" value="new text">
</form>
</BODY>
</HTML>
Refer this [^]for further reading.
hope it helps :)
使用此方法,
控件呈现在页面上,
但我希望该控件在页面上不可用,
意味着我需要在将Firebug隐藏后不能找到控件.
by using this method,
the control renders on page,
but i want it like the control should not be available on page,
means i need that firebug should not be able to find control after i hide it.
这篇关于如何在HTML代码中添加/删除评论运行时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文