[英]Multiple function call in one href tag
I'm developing one Flipbook
by using html
, css
, js
. 我正在使用html
, css
, js
开发一本Flipbook
。 Also, i have included video files with the Book. 另外,我在本书中包含了视频文件。 The problem with the book is, When i load the book for the first time, video file is working, after flipping Video is not working. 这本书的问题是,当我第一次加载这本书时,翻转视频后无法正常播放视频文件。 I found what the problem is. 我发现了问题所在。 It needs to be refreshed when each page turns. 每翻一页时都需要刷新。
The following is the code which i'm using to call the video file. 以下是我用来调用视频文件的代码。
<a class="voverlay" id="sk" href="index_videolb/vdbplayer.swf?volume=100&url=video/change1.mp4" onclick="javascript:myfunc();"><img src="index_videolb/thumbnails/change1.png"/></a>
<script>
function myfunc()
{
location.reload(true);
}
</script>
The problem with the code is, It only access the Onclick
function, not href
. 代码的问题是,它仅访问Onclick
函数,而不访问href
。
Is there anyother way to access both href
and onclick
? 还有其他访问href
和onclick
吗?
If you have both href
and onclick
, href
would override any onclick
behaviour. 如果您同时具有href
和onclick
,则href
将覆盖任何onclick
行为。 To avoid that you can do, 为避免您可以做到,
<script>
function myfunc(event)
{
event.preventDefault();
location.reload(true);
}
</script>
Try this 尝试这个
function myfunc() {
window.location = "index_videolb/vdbplayer.swf?volume=100&url=video/change1.mp4";
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.