-1
大家好,我正在嘗試擴展Chrome擴展,但我不確定該怎麼做!這是我的代碼(這是相當長的)我試圖做一個隨機化,當你點擊圖標,並有視頻,但我不能理解它,因爲我查了它,但是一個相當具體的問題!我如何在html中擴展視頻以擴展Chrome擴展
<html>
<head>
<style type="text/css">
body {
margin: 0px;
padding: opx;
font-family: Comic Sans MS;
font-size: 13px;
}
</style>
</head>
</body>
<body>
<button onclick="myFunction()">Try again</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = Math.floor((Math.random() * 6) + 1);
document.getElementById("demo").innerHTML = x;
}
if x = 1) {
<video width="320" height="240" controls>
<source src="Clip 1.mp4" type="video/mp4">
<source src="Clip 1.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
}
if x = 2) {
<video width="320" height="240" controls>
<source src="Clip 2.mp4" type="video/mp4">
<source src="Clip 2.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
}
if x = 3) {
<video width="320" height="240" controls>
<source src="Clip 3.mp4" type="video/mp4">
<source src="Clip 3.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
}
if x = 4) {
<video width="320" height="240" controls>
<source src="Clip 4.mp4" type="video/mp4">
<source src="Clip 4.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
}
if x = 5) {
<video width="320" height="240" controls>
<source src="Clip 5.mp4" type="video/mp4">
<source src="Clip 5.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
}
if x = 6) {
<video width="320" height="240" controls>
<source src="Clip 6.mp4" type="video/mp4">
<source src="Clip 6.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
}
</script>
</body>
</html>
感謝您的回覆!
感謝您的答覆內HTML!所以如何改變if語法。另外我不確定你的意思是你的第三點要點! – memed
或您的第四個要點! – memed