我在JavaScript Modal上的按钮不起作用

时间:2017-07-23 07:34:22

标签: javascript jquery html django

plz look at this picture, buttons not working

base.html文件



<html>
    <head>
        
<!-- 합쳐지고 최소화된 최신 CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">

<!-- 합쳐지고 최소화된 최신 자바스크립트 -->

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
	    
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
	    
	{% load staticfiles %}
        <link href="//fonts.googleapis.com/css?family=Lobster&subset=latin,latin-ext" rel="stylesheet" type="text/css">
        <link rel='stylesheet' href='http://fonts.googleapis.com/earlyaccess/nanumgothic.css'>
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
        <link rel="stylesheet" href="{% static 'css/debate.css' %}">
    </head>

    <body>
        <div class="page-header">
            {% now "N d, Y" %}
            <a href="{% url 'debate:post_new' %}" class="top-menu"><strong>write</strong></a>
            <a href="{% url 'debate:post_list' %}" class="top-menu"><strong>list</strong></a>
            <a href="{% url 'debate:user_login' %}" class="top-menu"><strong>login</strong></a><br/><br/>

            current ID : {{ request.user }}
        </div>

        <div class="content container">
            <div class="row">
                <div class="col-md-8">
                    {% block content %}
                    {% endblock %}
                </div>
            </div>
        </div>
    </body>

	<script>
$('#myModal').on('shown.bs.modal', function () {
  $('#myInput').focus()
})
	</script>

</html>
&#13;
&#13;
&#13;

post_detail.html

&#13;
&#13;
{% extends 'debate/base.html' %}

{% block content %}
    <!-- 토론 논제(제목) -->
    <h1>{{ object.title }}</h1>
    <!-- 토론 발의자 -->
    <p class="author">author : {{ object.author }}
    <!-- 토론시작날짜 -->
    <p class="date">{{ object.created_date|date:"y/m/d H:i" }}</p>

    <div class="body">
        {{ object.text|linebreaks }}
    </div>


	<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  삭제
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">삭제</h4>
      </div>
      <div class="modal-body">
        정말 삭제하시겠습니까?
      </div>
      <div class="modal-footer">
	      <a href="{{ get_absolute_url }}"<button type="button" class="btn btn-default" data-dismiss="modal">취소</button></a>
	      <a href="{{ post.get_url_remove }}"<button type="button" class="btn btn-primary">삭제</button></a>
      </div>
    </div>
  </div>
</div>

    {% ifequal post.author request.user %}
    <div>
        <a class="btn btn-default" href="{{ post.get_url_remove }}"><span class="glyphicon glyphicon-remove"></span></a>
	<a class="btn btn-default" href="{% url 'debate:post_edit' pk=object.pk %}"><span>수정</span></a>
    </div>
    {% endifequal %}
    <!-- 찬성/반대 -->
    <a class="btn btn-default" href="{{ post.get_url_pros }}"><span class="glyphicon glyphicon-thumbs-up"></span> {{ post.pros_count }}</a>
    <a class="btn btn-default" href="{{ post.get_url_cons }}"><span class="glyphicon glyphicon-thumbs-down"></span> {{ post.cons_count }}</a>

    <div>
	    <b>TAGS: </b>
    {% load tagging_tags %}
    {% tags_for_object object as tags %}
    {% for tag in tags %}
    <a href = "{% url 'debate:tagged_object_list' tag.name %}">{{tag.name}}</a>
    {% endfor %}
    <a href="{% url 'debate:tag_cloud' %}"<i>[ TagCloud ]</i></a>
    </div>
    <hr>

    Opnion
    <!-- 댓글 호출 -->
    {% for opinion in post.opinions.all %}

        <!-- 찬성/ 반대여부 -->
        {% ifequal opinion.pros_or_cons 1 %}
            <div class="opinion_pros">
                <!-- parent의 여부에 따라 어떤 의견에 개진한 것인지 알려줌 -->
                {% if opinion.get_parent_pk %}
                    TO {{ opinion.get_parent_name }}<br/>
                {% endif %}
        {% endifequal %}

        {% ifequal opinion.pros_or_cons 0 %}
            <div class="opinion_cons">
                <!-- parent의 여부에 따라 어떤 의견에 개진한 것인지 알려줌 -->
                {% if opinion.get_parent_pk %}
                    TO {{ opinion.get_parent_name }} <br/>
                {% endif %}
        {% endifequal %}
        <br/>
        <div class="opinion">
            <strong>AUTHOR : {{ opinion.author }}</strong>

            <!-- 댓글을 수정했다면, 수정된 시각 표현 -->
        	{% if not opinion.modified_date %}
        	   <div class="date">{{ opinion.created_date|date:"y/m/d H:i" }}</div>
        	{% else %}
        	   <div class="date">{{ opinion.created_date|date:"y/m/d H:i" }}({{ opinion.modified_date|date:"y/m/d H:i" }})</div>
        	{% endif %}


        	<p>{{ opinion.text|linebreaks }}</p>
        </div>

        <!-- TODO 로그인 여부에 따라, 본인이 맞는 지에 따라 활성화해야함 -->
	{% ifequal opinion.author request.user %}
	<a class="btn btn-default" href="{{ opinion.get_url_remove }}"><span class="glyphicon glyphicon-remove"></span></a>
        <a class="btn btn-default" href="{{ opinion.get_url_edit }}"><span>수정</span></a>
	{% endifequal %}
	<a class="btn btn-default" href="{{ opinion.get_url_opinion_to_opinion }}"><span>답글</span></a>
        <!-- 찬성/반대 -->
    	<a class="btn btn-default" href="{{ opinion.get_url_up }}"><span class="glyphicon glyphicon-thumbs-up"></span> {{ opinion.up_count }}</a>
    	<a class="btn btn-default" href="{{ opinion.get_url_down }}"><span class="glyphicon glyphicon-thumbs-down"></span> {{ opinion.down_count }}</a>
        </div>

        <br/>

        <!-- 댓글이 없는 경우 -->
        {% empty %}
            <p> No opinions here yet :( </p>

    {% endfor %}

    <!-- 새로운 댓글 작성 -->
    <a class="btn btn-default" href="{% url 'debate:opinion_to_post' pk=post.pk %}">ADD opinion</a>
    <a class="btn btn-default" href="{{ opinion.get_url_opinion_to_post }}">ADD opinion</a>

{% endblock %}
&#13;
&#13;
&#13;

这是我的css

&#13;
&#13;
@import url(http://fonts.googleapis.com/earlyaccess/nanumgothic.css);

.page-header {
    background-color: #A3E4D7;
    margin-top: 0;
    padding: 20px 20px 20px 40px;
}

.page-header h1, .page-header h1 a, .page-header h1 a:visited, .page-header h1 a:active {
    color: #212F3D;
    font-family: 'Nanum Gothic', serif;
    font-size: 36pt;
    text-decoration: none;
}

.content {
    font-family: 'Nanum Gothic', serif;
    margin-left: 40px;
}

.opinion {
    font-family: 'Nanum Gothic', serif;
    margin-left: 40px;
    margin-right: 40px;
}
h1, h2, h3, h4 {
    font-family: 'Nanum Gothic', serif;
}

.date {
    color: #000000;
    font-family: 'Nanum Gothic', serif;
}
.save {
    float: right;
}

.post-form textarea, .post-form input {
    width: 100%;
}

.top-menu, .top-menu:hover, .top-menu:visited {
    color: #ffffff;
    float: right;
    font-size: 26pt;
    margin-right: 20px;
    font-family: 'Nanum Gothic', serif;
}

.post {
    margin-bottom: 70px;
}

.post h1 a, .post h1 a:visited {
    color: #000000;
}

.opinion_pros{
    font-family: 'Nanum Gothic', serif;
    margin: 0px 0px 0px 0px;
    border: 1.5px solid #2196F3;
    border-radius: 10px;
}

.opinion_cons{
    font-family: 'Nanum Gothic', serif;
    margin: 0px 0px 0px 0px;
    border: 1.5px solid #F44336;
    border-radius: 10px;
}
&#13;
&#13;
&#13;

为什么模态上的按钮不起作用? 我甚至无法点击它们。它全是灰色的。 它的django模板...... 왜안올려주냐올리게해줘ㅠㅠㅠㅠ 자세한설명 리리해줘어

리리해줘어

0 个答案:

没有答案