Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/374.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 通过扩展chrome控制播放器按钮_Javascript_Html_Api_Google Chrome - Fatal编程技术网

Javascript 通过扩展chrome控制播放器按钮

Javascript 通过扩展chrome控制播放器按钮,javascript,html,api,google-chrome,Javascript,Html,Api,Google Chrome,我创建了扩展: HTML代码较低: <input id="play1" type="image" src="images/121.png" type="button" alt="Воспроизвести"/> <input id="pause1" type="image" src="images/120.png" type="button" alt="Пауза"/> <input id="next1" type="image" src="images/1

我创建了扩展: HTML代码较低:

<input id="play1" type="image" src="images/121.png"  type="button"  alt="Воспроизвести"/>
<input id="pause1" type="image" src="images/120.png"  type="button" alt="Пауза"/>
<input id="next1" type="image" src="images/122.png"   type="button" alt="След.трек"/>
播放器按钮的控制代码:

<input id="play1" type="image" src="images/121.png"  type="button"  alt="Воспроизвести"/>
<input id="pause1" type="image" src="images/120.png"  type="button" alt="Пауза"/>
<input id="next1" type="image" src="images/122.png"   type="button" alt="След.трек"/>
<div id="ac_controls" class="fl_l">
    <div id="ac_play" class="fl_l"></div>
    <div class="next_prev fl_l">
      <div id="ac_prev" class="ctrl_wrap">
        <div class="prev ctrl"></div>
      </div>
      <div id="ac_next" class="ctrl_wrap">
        <div class="next ctrl"></div>
      </div>
    </div>
  </div>

然后您需要使用
窗口。onload
。您的脚本将如下所示:

<input id="play1" type="image" src="images/121.png"  type="button"  alt="Воспроизвести"/>
<input id="pause1" type="image" src="images/120.png"  type="button" alt="Пауза"/>
<input id="next1" type="image" src="images/122.png"   type="button" alt="След.трек"/>
 <script type="text/javascript">

window.onload = function() {
    document.getElementById("play1").onclick = function() {
        alert("hello"); //for testing
    }
}
 </script>

您是否在html文件中引用jQuery?例如:
@pavel bogrInstead of aleret(');我需要按下选项卡中的按钮:https:/test.com/audio/,按钮播放器的代码上述按钮播放器的代码