0

我正在编写一个网络应用程序,它应该在某个页面上显示以下内容:

  1. AudioJS 播放器
  2. 反馈面板(评分和评论)

我希望播放器出现在反馈面板之前。

如果我将以下代码放入该页面,则会显示音频播放器。

代码:

<h2><%= I18n.t(:home_title) %></h2>
<script src="/audiojs/audio.min.js"></script>
<script>
  audiojs.events.ready(function() {
    var as = audiojs.createAll();
  });
</script>
<h3><%= I18n.t(:playback_feedback_title) %></h3>
<%= I18n.t(:playback_feedback_body) %>
<form action="/<%= I18n.locale %>/save_feedback" method="post">
    <%= I18n.t(:playback_rating) %>
    <select name="grade">
      <option value="0"><%= I18n.t(:playback_rating_0) %></option>
      <option value="1"><%= I18n.t(:playback_rating_1) %></option>
      <option value="2"><%= I18n.t(:playback_rating_2) %></option>
      <option value="3"><%= I18n.t(:playback_rating_3) %></option>
      <option value="4"><%= I18n.t(:playback_rating_4) %></option>
      <option value="5"><%= I18n.t(:playback_rating_5) %></option>
    </select>
    <br/>
    <%= I18n.t(:playback_comment) %>
    <br/>
    <textarea name="comment" rows="5" cols="50">
    </textarea>
    <br/>
    <input type="hidden" name="person_id" value="<%= @person_id.to_s %>">
    <input type="hidden" name="song_id" value="<%= @songId %>"> 
    <br/>
    <input type="submit" value="<%= I18n.t(:playback_submit) %>">
</form>
<audio src="<%= @songPath %>" preload="auto" />´

结果:

截屏

但是当我更改代码使音频播放器出现反馈面板之前时,后者消失了。

代码:

<h2><%= I18n.t(:home_title) %></h2>
<script src="/audiojs/audio.min.js"></script>
<script>
  audiojs.events.ready(function() {
    var as = audiojs.createAll();
  });
</script>
<audio src="<%= @songPath %>" preload="auto" />
<h3><%= I18n.t(:playback_feedback_title) %></h3>
<%= I18n.t(:playback_feedback_body) %>
<form action="/<%= I18n.locale %>/save_feedback" method="post">
    <%= I18n.t(:playback_rating) %>
    <select name="grade">
      <option value="0"><%= I18n.t(:playback_rating_0) %></option>
      <option value="1"><%= I18n.t(:playback_rating_1) %></option>
      <option value="2"><%= I18n.t(:playback_rating_2) %></option>
      <option value="3"><%= I18n.t(:playback_rating_3) %></option>
      <option value="4"><%= I18n.t(:playback_rating_4) %></option>
      <option value="5"><%= I18n.t(:playback_rating_5) %></option>
    </select>
    <br/>
    <%= I18n.t(:playback_comment) %>
    <br/>
    <textarea name="comment" rows="5" cols="50">
    </textarea>
    <br/>
    <input type="hidden" name="person_id" value="<%= @person_id.to_s %>">
    <input type="hidden" name="song_id" value="<%= @songId %>"> 
    <br/>
    <input type="submit" value="<%= I18n.t(:playback_submit) %>">
</form>

结果:

截屏

我该如何解决(让音频播放器出现在反馈表之前)?

4

1 回答 1

1

Mb 问题是<audio>需要关闭标签。

于 2016-12-08T22:43:03.637 回答