可以使用DHTML完成动态按钮吗?

时间:2019-07-14 18:38:35

标签: javascript python flask dhtml

+--------------+------------+------------------------+-------------------+------------+------------------------+-------------------+----------------------------------+
|    string    | word_count | punctuation_char_count | number_char_count | char_count | punctuation_proportion | number_proportion | punctuation_or_number_proportion |
+--------------+------------+------------------------+-------------------+------------+------------------------+-------------------+----------------------------------+
| helloword    |          2 |                      0 |                 0 |          9 | 0                      | 0                 | 0                                |
| mynameisanon |          3 |                      0 |                 0 |         12 | 0                      | 0                 | 0                                |
| !23name      |          1 |                      1 |                 2 |          7 | 0.142857143            | 0.285714286       | 0.428571429                      |
+--------------+------------+------------------------+-------------------+------------+------------------------+-------------------+----------------------------------+

我想创建一个动态网页,将目录显示为按钮,一旦用户单击特定按钮,它就会显示子目录的按钮。但是我似乎无法识别出我要去哪里。

这是使用Flask,python和DHTML

{% extends "base1.html" %}
{% block content %}	
	<div>
      <p style="text-align: center;color: rgb(255, 250, 240); font-size: 150% ;font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif">
        SRN: {{ username }} <br>Branch: {{ branch }}<br>Semester: {{ sem }} 
      </p>
    </div>
{% endblock %}
{% block footer %}
  <h3>Semester {{ sem }} <br></h3>
  {% for i in c_mat %}
    <button type="button" onclick="fun()">{{ i }}</button> <br><br>
  {% endfor %}
 <p id="myText"></p> 
  <script type="text/javascript">
    function fun()
    {
      //alert("Hello World");
	  document.write("hello")
      var path_js = {{ path }};
      path_js += '\\' + {{ i }};
      alert(path_js);
      document.getElementById('myText').innerHTML = path_js;
    }
  </script>

{% endblock %}

0 个答案:

没有答案