Play a sound when clicking a hyperlink?

C

Chris Ianson

If that's all you want to do just use a hyperlink to the sound file and
let the user's configuration for handling sound take care of it.

Sorry Ed, thanks but if you follow the thread you will see the hyperlink
needs to load a new URL AND play a sound. See my post below.
 
A

Adrienne Boswell

I have never figured out why people on these groups are always so
hostile. We're all fellow human beings, but nobody wants to help anyone
anymore. It's really really sad.

You don't understand... it's not a matter of whether anyone wants to help
you. Usenet is for discussion, it is not a help desk. You may or may not
get an answer to your question in a discussion.
 
J

Jonathan N. Little

Chris said:
The site hasn't even started being built yet, so there is no URL.

To recap, here is what I would like:

Page loads, sounds are off
A link on the page saying "Sound: ON / OFF"
When sounds are switched on, and a user clicks a hyperlink, it plays said
sound *AND* takes them to that hyperlink's URL

Surely not rocket science?

Ah be there lies the rub, see in the past to make this work it was very
browser dependent with proprietary elements and all, and now with new
more standardized browsers (real web browsers) a lot of the old methods
will just not work. Period. So if you feel you must, then I'd say flash
is your best option. At least your visitors will know what is coming and
can bail if they wish.
 
N

Neredbojias

With neither quill nor qualm, Chris Ianson quothed:
I have never figured out why people on these groups are always so hostile.
We're all fellow human beings, but nobody wants to help anyone anymore.
It's really really sad.

It's because we don't get out enough and all the cloistered solitude can
lead to abusive paranoia.

Eek!! There goes a mouse that looks like rf!
 
S

Sid Ismail

On Sat, 18 Mar 2006 12:39:11 -0700, Neredbojias

: It's because we don't get out enough and all the cloistered solitude can
: lead to abusive paranoia.
:
: Eek!! There goes a mouse that looks like rf!


It was let loose by Brucie... :)

Sid
 
B

Blinky the Shark

Jonathan said:
Look at it this way, although there are many differences between a website
a print media, they are a like as a reference resource. Consider what a
library would be like if every time one turned a page in a book there was
a POP!, BOING! or AH-WHOOGA!

Now *there's* an image! Sounds like a scene from a Three Stooges short,
when the boys go looking for a book at Slapstick Library. :)
 
B

Blinky the Shark

Chris said:
Are you saying that is bad web design and freedom of choice is not allowed
because this group's 'regulars' (how cool) say so?

Nobody is infringing your freedom of choice. That's proven by the fact
that you *have* chosen to use sounds.
 
D

dorayme

Neredbojias said:
With neither quill nor qualm, dorayme quothed:


If it is very loud, it has to occur. Since it can't occur, it can't be
loud. My opinion of Martian intelligence has plummeted lately.

Boji, you have been badly affected by being in BdeZ's killfile.
Try to imagine a sound that is so loud that it breaks all logical
barriers and just roll about the floor in paroxysms of laughter
at this instead of casting aspersions on Martian intelligence.

Look, I know it will be bad when you meet Officer Bud White. I
know it is troubling you. But it will not be the end of the world
and you will emerge a better and stronger man.

And, btw, don't stir up that "mad hatter" crowd, a few of their
threads have (after a long absence) started appearing, complete
with foul language, on my newsreader.
 
N

Neredbojias

With neither quill nor qualm, Sid Ismail quothed:
On Sat, 18 Mar 2006 12:39:11 -0700, Neredbojias

: It's because we don't get out enough and all the cloistered solitude can
: lead to abusive paranoia.
:
: Eek!! There goes a mouse that looks like rf!


It was let loose by Brucie... :)

And this is not the first time I've heard Brucie's name connected to
rodentry.
 
N

Neredbojias

With neither quill nor qualm, dorayme quothed:
Boji, you have been badly affected by being in BdeZ's killfile.
Try to imagine a sound that is so loud that it breaks all logical
barriers and just roll about the floor in paroxysms of laughter
at this instead of casting aspersions on Martian intelligence.

BdeZ's killfile is like the Devil's Island of the Information Highway.
You can't imagine the depths of depravity and insouciance suffered by
denizens of that digital deep. Oh...what am I talking about? You're
there, too. That explains it.
Look, I know it will be bad when you meet Officer Bud White. I
know it is troubling you. But it will not be the end of the world
and you will emerge a better and stronger man.

And, btw, don't stir up that "mad hatter" crowd, a few of their
threads have (after a long absence) started appearing, complete
with foul language, on my newsreader.

I don't view them as a crowd, I view each as an individual with a unique
persona and responsible for his/her own commentary just as anyone would
be. Casually categorizing people into groups leads to discrimination
which I have found that Australians in particular are far from free of.
 
J

Jacob.Lyles

Hello,

I don't know what I'm talking about, but might wrapping some text with
nested links work, one for the web page and one for the sound? Lacking
that, you could use a Javascript onClick() event handler to redirect
them after clicking the link, but you'd be dependent on them having
Jscript turned on (which 95% of people do anyway).
 
E

Ed Mullen

Chris said:
Sorry Ed, thanks but if you follow the thread you will see the hyperlink
needs to load a new URL AND play a sound. See my post below.

I did follow the thread. I was responding specifically to your one post
and statement.

Now. A simple link to a new page that uses some combination of OBJECT,
BGSOUND, and/or EMBED will probably do what you want. Not a good
practice for various reasons. You can Google those key words and read why.

I am like many (perhaps most) people in despising Web pages that
automatically (and surprisingly) play sounds. I think it's fine to
offer sound to visitors (I do on my site) but it is preferable to
clearly indicate such links and have the event only happen by the user
making a positive choice to hear the sound. Just my 3.5 cents (adjusted
for inflation). But I agree: it's your site and your design choice.
 
J

Jonathan N. Little

Hello,

I don't know what I'm talking about, but might wrapping some text with
nested links work, one for the web page and one for the sound? Lacking
that, you could use a Javascript onClick() event handler to redirect
them after clicking the link, but you'd be dependent on them having
Jscript turned on (which 95% of people do anyway).

You cannot nest links...a hack employed by black-hats on the web to do
very nasty things, up to date modern browsers will not fall for the trick.

TIP: in the future quote the part of the message that you are replying
to. Many folks use real newsreaders and not via webpage as Google Groups
and we do not see all the messages in a thread in a single window.
 
B

Blinky the Shark

Neredbojias said:
With neither quill nor qualm, Sid Ismail quothed:


And this is not the first time I've heard Brucie's name connected to
rodentry.

Okay, who ratted on him?
 
C

Chris Ianson

Hello,

I don't know what I'm talking about, but might wrapping some text with
nested links work, one for the web page and one for the sound? Lacking
that, you could use a Javascript onClick() event handler to redirect
them after clicking the link, but you'd be dependent on them having
Jscript turned on (which 95% of people do anyway).

Thanks for a sensible reply to my question which was 'how to' do it (not
'should I' and 'please give your opinion on if it's a bad idea').

Can you give an example of such code that will call a URL hyperlink and play
a sound when clicked please.

Cheers!
 
C

Chris Ianson

Now. A simple link to a new page that uses some combination of OBJECT,
BGSOUND, and/or EMBED will probably do what you want.

That's great. Can you give some example of actual working code (a couple of
lines of your time) that will do this please? Would really appreciate it.
I am like many (perhaps most) people in despising Web pages that
automatically (and surprisingly) play sounds.

Again, I also will have the option to turn sounds ON or OFF, and they will
start OFF so it is up to the user - therefore there is no automatic or
surprising sound.

Thanks.
 
B

Barbara de Zoete

I don't know what I'm talking about, but might wrapping some text with
nested links work, one for the web page and one for the sound?

Thanks for a sensible reply to my question which was 'how to' do it (not
'should I' and 'please give your opinion on if it's a bad idea').[/QUOTE]

Well, this is a usenet newsgroup. What this implies is
<URL:http://groups.google.com/group/alt.html/msg/846f8ab01cc63400>.

BTW: the nested links that are proposed, are not possible with html:

,------[ <URL:http://www.w3.org/TR/html401/struct/links.html#edef-A> ]
| 12.2.2 Nested links are illegal
|
| Links and anchors defined by the A element must not
| be nested; an A element must not contain any other
| A elements.
`------
 
E

Evertjan.

Chris Ianson wrote on 19 mrt 2006 in comp.lang.javascript:
Thanks for a sensible reply to my question which was 'how to' do it
(not 'should I' and 'please give your opinion on if it's a bad idea').

it seems a bad idea
Can you give an example of such code that will call a URL hyperlink
and play a sound when clicked please.

Cheers!

<bgsound src="silend.mid" id="song">

<a href="http://cnn.com/" onclick="return soundlink(this);">
Play Clip</a>

<script >
var where;
function soundlink(x){
where=x;
document.getElementById('song').src='3secSound.mid';
setTimeout('location.href=where.href',3000);
return false;
}
</script>
 
J

Jonathan N. Little

Evertjan. said:
Chris Ianson wrote on 19 mrt 2006 in comp.lang.javascript:




it seems a bad idea




<bgsound src="silend.mid" id="song">

<a href="http://cnn.com/" onclick="return soundlink(this);">
Play Clip</a>

<script >
var where;
function soundlink(x){
where=x;
document.getElementById('song').src='3secSound.mid';
setTimeout('location.href=where.href',3000);
return false;
}
</script>
I like that idea 'cuz it will NOT work in my browser! You will only
annoy IE users. I also recall your cannot script it to turn on or off
the sound like Netscape's attempt at this with EMBED, it is background
sound *only* where you can control the looping and initial delay in
playing when the pages loads. Also your document will not validate with
BGSOUND element it was never part of HTML.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top