【发布时间】:2018-04-01 20:45:31
【问题描述】:
口头反馈后如何进行页面重定向,
"const sentence = 'Oh Hello,' + name +'.I am Eve. ....'+name +'= human?!..Ive never seen one of those...What does' +name +' look like?';
responsiveVoice.speak(sentence, "US English Female", {rate: 0.5}, {pitch: -2});"
整个句子完成后我需要立即重定向网站https://www.google.com/?
我在想我需要插入这段代码才能让它工作是这样的;
video.addEventListener('ended',function(){
location.replace ('http://www.google.com'),
但我根本不懂 javascript,因此非常感谢任何视觉帮助。这是我网站的当前结构。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>eve_</title>
<link rel="icon" rel="preload" href="images/evecircle.png" />
<style>
#video {
margin-left:-10px;
margin-top:-10px;
}
</style>
<script src="https://code.responsivevoice.org/responsivevoice.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<style type="text/css">
body {
overflow:hidden;
}
</style>
<body onload="delayedAlert();">
<script>
var timeoutID;
function delayedAlert() {
timeoutID = window.setTimeout(slowAlert, 3000);
}
function slowAlert() {
var audio= document.getElementsByTagName('audio')[0];
const audio2 = document.getElementsByTagName('audio')[1];
var audio3 = document.getElementsByTagName('audio')[2];
var audio4 = document.getElementsByTagName('audio')[3];
audio.play();
var myvar1;alert('....Hello?');
audio2.play();
var myvar1;alert('Something is here.');
audio3.play();
var myvar2;alert('Hello?');
audio4.play();
const name = prompt('What is your name?')
const sentence = 'Oh Hello,' + name +'.I am Eve. ....'+name +'= human?!..Ive never seen one of those...What does' +name +' look like?';
responsiveVoice.speak(sentence, "US English Female", {rate: 0.5}, {pitch: -2});
}
</script>
<audio>
<source src="images/hellllloooo.wav" type="audio/wav" preload=true>
</audio>
<audio>
<source src="images/sorry.wav?.wav?.wav" type="audio/wav" preload=true>
</audio>
<audio>
<source src="images/sorry.wav?.wav?.wav" type="audio/wav" preload=true>
</audio>
<audio>
<source src="images/whatisyourname.wav" type="audio/wav" preload=true>
</audio>
<video autoplay="autoplay" preload="auto" id="video" src="images/secondnew.mp4" width="1300px" height="auto" style="position:absolute; z-index:-1;" >
Video not supported.
</video>
</body>
</html>
【问题讨论】:
标签: javascript replace location constants sentence