/    Sign up×
Community /Pin to ProfileBookmark

pause video when a button clicked

hi,

my website is:[URL=”http://http://www.terranartworks.com/testsite/tsv1/index.html”]http://http://www.terranartworks.com/testsite/tsv1/index.html[/URL]

the video begins automatically.i want to pause the video,when user clicks one of three buttons on bottom of page.i use anything slider jquery for this.
how can i do this?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@tenfoldJul 26.2013 — [CODE]function pause() {
document.getElementById('video').pause();
}[/CODE]


then you will need to call this function when a button is pressed. You could add an 'onclick' attribute to the button if you want.

[CODE]<a href='foo' onclick='pause()'>bar</a>[/CODE]
Copy linkTweet thisAlerts:
@sweetysweetyauthorJul 26.2013 — thank you.i used below code and it worked.?

[CODE]
var button1,button2,button3;
function initializePlayer()
{
button1=document.getElementById("button1");
button2=document.getElementById("button2");
button3=document.getElementById("button3");
button1.addEventListener("click",buttonClick,false);
button2.addEventListener("click",buttonClick,false);
button3.addEventListener("click",buttonClick,false);
}
window.onload=initializePlayer;
function buttonClick()
{
if(!vid.paused){vid.pause();}
}
[/CODE]
Copy linkTweet thisAlerts:
@tenfoldJul 26.2013 — You're welcome ? Glad it worked.
×

Success!

Help @sweetysweety spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...