我知道可以使用Javascript动态地将HTML元素添加/删除到网页上。 我想知道以下可能 -
我的coldfusion网页有一个双列表格,表格的最后一行在第一列中有一个链接,第二列是空白的。 当用户点击那个链接时,textarea出现在第二列,到目前为止是空白的。
是否有可能使用Javascript来做到这一点? 我浏览了网络上的几个链接,并且像http://www.dustindiaz.com/add-and-remove-html-elements-dynamically-with-javascript/这样的一些指针确实有帮助,但似乎他们没有帮助我在我的场景。
我在这里先向您的帮助表示感谢。
I know it is possible to add/remove HTML elements dynamically to a web page using Javascript. I was wondering is the following possible-
My coldfusion web page has a two column table and the last row of the table has a link in the first column and the second column is blank. When user hits that link, a textarea shows up in the second column which was blank so far.
Is it possible to do this using Javascript? I went through a few links on the web and a few pointers like http://www.dustindiaz.com/add-and-remove-html-elements-dynamically-with-javascript/ did help but it seems they don't help me on my scenario.
Thanks for the help in advance.
最满意答案
对于您的场景,可能不需要添加元素。 您可以改为将元素加载到dom中(但隐藏),然后在点击链接时触发一些代码以显示它。 这个javascript很简单。
function ShowTextArea() { var ta = document.getElementById("textareaId"); ta.style = "display:inline"; }For your scenario, it may not be necessary to add the element. You could instead have the element already loaded in the dom (but hidden), then fire some code to show it when the link is clicked. The javascript for that is quite simple.
function ShowTextArea() { var ta = document.getElementById("textareaId"); ta.style = "display:inline"; }更多推荐
发布评论