可隐藏评论框

发布于 2024-08-16 22:27:55 字数 1782 浏览 6 评论 0原文

我有一个时间跟踪表应用程序。在此,我将在 X 轴(顶部)上显示一周中的日期,在 Y 轴(向下)上显示任务。如下所示,我将在每个文本框后面给出一个 @ 图标,用于针对每个条目输入评论。

****************************************************
#    |  Sun | Mon  | Tue  | Wed | Thu |  Fri | Sat |
****************************************************
Task1 ____@ _____@ _____@ _____@_____@______@______@     
Task2 ____@ _____@ _____@ _____@_____@______@______@

因此,单击此 @ 图标时,我需要打开一个浮动(或任何其他类型的文本框)以输入注释)。在打开的图标上按 X 标记后,需要将其隐藏。正如您所期望的,我需要存储该用户输入的评论以发送到数据库。那么如何将这些注释存储为数组变量呢?我已经完成了任务输入和总表的编码。但我无法弄清楚如何在特定@图标的位置打开浮动文本框。而且在隐藏它们之后,我没有找到有效的方法来存储针对特定日期的这些特定任务的这些评论。

我的示例 Javascript:

function comment(id,day)
{
var textinput="<div id='closeit'>
                  Comments:<input type='text' name='comm["+id+"]["+day+"]' />
               </div>
               <div id='closing' onclick='closecomment("+id+","+day+")'>X
               </div>";
              $('#comms').html(textinput);
}
function closecomment(id,day)
{
        var str='"comm['+id+']['+day+']"';
        var element = document.getElementById(str);
        alert(element.value);
        closeit.style.visibility='hidden' // this is for hiding
    closing.style.visibility='hidden' // this is for hiding
    var newelement = document.getElementById(str);
    alert(newelement.value); //I am able to get the value but I am looking for         storing  it and filling the same text box when it is accessed again
}

我的示例 HTML:

<input type="text" id="comm[0][0]" />
<input type="text" id="comm[0][1]" />
<input type="text" id="comm[1][0]" />
<input type="text" id="comm[1][1]" />

请帮助我提供任何可以在 IE6 或 IE7 或 8 上运行的示例。我的环境是 PHP(CodeIgniter 框架)、JQUERY、XAMPP。

I have a time tracking sheet application. In this I will display dates in a week on X axis (on top) and Tasks on Y-axis (downwards). As shown below, I will give a @ icon after every text box for entering comments against each entry.

****************************************************
#    |  Sun | Mon  | Tue  | Wed | Thu |  Fri | Sat |
****************************************************
Task1 ____@ _____@ _____@ _____@_____@______@______@     
Task2 ____@ _____@ _____@ _____@_____@______@______@

So On clicking this @ icon I need to open a floating (or any other type of text box) for entering comments).This needs to be hidden after pressing X mark on the opened one. As you will expect I need to store this user entered comments to send to database. So how can I store these comments as array variables. I have completed coding for Task entering and the total table. But I am not able to figure out how to open a floating text box at the position of particular @ icon. And also after hiding them I am not getting efficient way of storing these comments against these particular Tasks for a particular day.

My sample Javascript:

function comment(id,day)
{
var textinput="<div id='closeit'>
                  Comments:<input type='text' name='comm["+id+"]["+day+"]' />
               </div>
               <div id='closing' onclick='closecomment("+id+","+day+")'>X
               </div>";
              $('#comms').html(textinput);
}
function closecomment(id,day)
{
        var str='"comm['+id+']['+day+']"';
        var element = document.getElementById(str);
        alert(element.value);
        closeit.style.visibility='hidden' // this is for hiding
    closing.style.visibility='hidden' // this is for hiding
    var newelement = document.getElementById(str);
    alert(newelement.value); //I am able to get the value but I am looking for         storing  it and filling the same text box when it is accessed again
}

My sample HTML:

<input type="text" id="comm[0][0]" />
<input type="text" id="comm[0][1]" />
<input type="text" id="comm[1][0]" />
<input type="text" id="comm[1][1]" />

Please help me with any examples which can work on IE6 or IE7 or 8. My environment is PHP (CodeIgniter framework), JQUERY, XAMPP.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌辣 2024-08-23 22:27:55

对于存储部分,您根本不必使用数组。只需在每个“@”链接旁边(或页面中的任何位置)添加一个具有有意义名称的隐藏输入即可。当您关闭浮动 div 时,将注释放入隐藏输入中。然后您的 php 文件将能够在提交时读取并处理这些值。

显示浮动 div 只是绝对(或相对,如果您想显示在​​表格单元格旁边)定位的问题。试试这个CSS:

div#comms {
  position: absolute;
  width: 300px;
  left: 50%;
  margin-left:-100px;
  height: 200px;
  top: 50%;
  margin-top:-150px;
}

For the storing part, you don't have to use an array at all. Just add a hidden input next to every '@' link (or anywhere in the page, for that matter) with a meaningful name. When you close the floating div, put the comment into the hidden input. Then your php file will be able to read and process these values on submission.

Displaying a floating div is just a matter of absolute (or relative, if you want to display next to the table cells) positioning. Try this css:

div#comms {
  position: absolute;
  width: 300px;
  left: 50%;
  margin-left:-100px;
  height: 200px;
  top: 50%;
  margin-top:-150px;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文