/    Sign up×
Community /Pin to ProfileBookmark

stop and start music

is it possible to start or stop the music by clicking on the same text
I would lik to start or stop the music by clicking on the text and alsow change the text, sow music plays you see the stop text, when you click music stops and you see the play text

<html>
<head>

<script language=”JavaScript”>
<!–
function startPlay() {
document.all[‘BGSOUND_ID’].src=’x.mp3′
}

function stopPlay() {
document.all[‘BGSOUND_ID’].src=”
}

//–>
</script>

</head>
<body>
<BGSOUND ID=”BGSOUND_ID” LOOP=1 VOLUME=”-600″ SRC=”onestop.mid”>
<a href=”javascript:startPlay();”>play</a></p>
<a href=”javascript:stopPlay();”>stop</a></p>
</body>
</html>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@jamFeb 15.2006 — yerh use an if else function:

[CODE]<html>
<head>

<script language="JavaScript">
<!--
function toggle() {
if (document.all['BGSOUND_ID'].src==''||document.all['BGSOUND_ID'].src=='onestop.mid'){
document.all['BGSOUND_ID'].src='x.mp3'
}
else{
document.all['BGSOUND_ID'].src=''
}
}

//-->
</script>

</head>
<body>
<BGSOUND ID="BGSOUND_ID" LOOP=1 VOLUME="-600" SRC="onestop.mid">
<a href="javascript:toggle();">Toggle on/off</a></p>
</body>
</html>[/CODE]

this will toggle the sound on/off as the first src of the bgsound is onestop.mid it still works
Copy linkTweet thisAlerts:
@CGGauthorFeb 16.2006 — Nice, but is it also possible that thex I can change the text according to when the music is playing the text is turn off en when there's is now music the text is 'start music'
×

Success!

Help @CGG 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.26,
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,
)...