首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在组织内部关闭组织

如何在组织内部关闭组织
EN

Stack Overflow用户
提问于 2013-06-24 23:55:50
回答 1查看 165关注 0票数 0

也许我不能用一行标题来描述我的问题..描述如下..

我用除法做了一个提示符..页面上的html是..

代码语言:javascript
复制
<button id="prompt_open" name="prompt_open">open</button>
<div id="prompt" style="display:none"></div>

现在,我通过javascript(jquery)代码在提示符中生成和html的属性。

代码语言:javascript
复制
$("#post_video").click(function () {
        var the_prompt = $("#Stuffprompt_main");
        the_prompt.css('display', 'block');
        var prompt_html = "";
        the_prompt.css('top', '95px');
        the_prompt.css('position', 'absolute');
        the_prompt.css('left', '300px');
        the_prompt.css('width', '610px');
        the_prompt.css('border', 'thin');
        the_prompt.css('background-color', '#FFF');
        the_prompt.css('height', 'auto');
        the_prompt.css('z-index', '9999');
        the_prompt.attr('id', 'post_prompt');
        the_prompt.attr('name', 'post_prompt');

        var shut_box = "<a id=\"close_prompt_vdo\" name=\"close_prompt_vdo\" class=\"shut\"></a>";

        var header = '<div class="header_prompt"><span id="pr" class="prompt_title">Post video of your stuff</span></div>';
        var middler = "<form action=\"user_posting/post_video.php\" name=\"posting_photos\" id=\"posting_photos\" method=\"post\" enctype=\"multipart/form-data\">" +
            "<div class=\"object_container\">" +
            "<textarea name=\"title_postvideo\" id=\"title_postvideo\" class=\"descriptor\" maxlength=\"100\" placeholder=\"Tilte\" style=\"height:30px;\" ></textarea>" +
            "<textarea name=\"text_postvideo\" id=\"text_postvideo\" class=\"descriptor\" maxlength=\"200\" placeholder=\"Add some description\" ></textarea>" +
            "<div class=\"file_Container\">" +
            "<div class=\"text_box_container\">" +
            "<textarea name=\"YTB_link\" id=\"YTB_link\"  class=\"descriptor\" style=\"float:left;width:75%; border:thin; border-color: #333;\"  maxlength=\"200\" placeholder=\"Add link of your video on You tube\"></textarea>" + "<div style=\"float:left; width:120px; height:80px; background-repeat:no-repeat; background-image:url(images/tube_logo.jpg);\"></div></div>" + "<div class=\"gap\"></div>" + "<div class=\"text_box_container\">" + "<textarea name=\"VMO_link\" id=\"VMO_link\" class=\"descriptor\" style=\"float:left;width:75%; border:thin; border-color: #333;\"  maxlength=\"200\" placeholder=\"Add link of your video on Vimeo\"></textarea>" + "<div style=\"float:left; width:135px; height:80px; background-repeat:no-repeat; background-image:url(images/vm_logo.jpg);\"></div></div></div><center>" + "<button id=\"post_video_submit\" class=\"base_buttons\" style=\"margin-top:10px;\"></button>" + "</center></div></form>" + "<div class=\"gap\"></div>";


        var HTML = shut_box + header + middler;
        the_prompt.html(HTML);
        $("#close_prompt_vdo").click(function () {

            the_prompt.css('display', 'none');

        });

这是代码第一次运行,即“prompt_open”按钮打开提示,"close me“按钮关闭提示。但是当我第二次点击“打开提示”按钮时,什么也没有发生,也就是没有显示提示。

该怎么办??

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-25 01:15:04

the_prompt.attr('id','post_prompt');

是邪恶的一条线。你干吗要干那种事?这使得第二次选择var the_prompt作为$("#Stuffprompt_main")是不可能的。

解决此问题的一些可能性:

  • 删除该行(可能您实际上并不需要它)
  • var the_prompt = $("#Stuffprompt_main");赋值移到click处理程序之外,这样它就不会每次都被执行(并且当id是close-click-handler

中的id属性时仍然指向元素

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17279789

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档