Author Topic: Play Sound When clicking an Image  (Read 13791 times)

0 Members and 2 Guests are viewing this topic.

Offline blmg911Topic starter

  • Enthusiast
  • Posts: 452
    • View Profile
Play Sound When clicking an Image
« on: October 10, 2008, 03:58:34 PM »
I need some php coding for playing click.wav with i click the sound.jpg images. can anyone show me how to do it? thanks
It's do or do not do! There is no try! - Yoda

It's all in your <head>!

Remember for safe web programming always use protection, use a COMMA! :D

Online The Little Guy

  • Freak!
  • Posts: 6,103
  • Gender: Male
  • Jinkies!
    • View Profile
    • PHPSnips
Re: Play Sound When clicking an Image
« Reply #1 on: October 10, 2008, 03:59:49 PM »
That would be JavaScript, or flash.
phpLive - A powerful library that implements many common tasks to make php programming faster. Supports extensions and plugins. Current version: 1.0.0-Alpha
JPG to ASCII Converter | Advanced Image CAPTCHA | Simple User Login | Check If User Is Logged In
http://dreamhost.com (promo code: 8RN4)
$30 off 1 year of hosting
$40 off 2 years of hosting

Offline blmg911Topic starter

  • Enthusiast
  • Posts: 452
    • View Profile
Re: Play Sound When clicking an Image
« Reply #2 on: October 10, 2008, 04:10:52 PM »
No it wouldn't i've seen it in php i used to have a code but lost the script
« Last Edit: October 10, 2008, 04:11:35 PM by blmg911 »
It's do or do not do! There is no try! - Yoda

It's all in your <head>!

Remember for safe web programming always use protection, use a COMMA! :D

Online KevinM1

  • Global Moderator
  • Fanatic
  • *
  • Posts: 3,911
  • Gender: Male
    • View Profile
Re: Play Sound When clicking an Image
« Reply #3 on: October 10, 2008, 04:12:15 PM »
No it wouldn't

Uh, yeah, it would.  PHP doesn't do client-side events.
Don't go to w3schools.  Here's why
Every time a PHP coder uses 'global' a kitten dies.

Offline blmg911Topic starter

  • Enthusiast
  • Posts: 452
    • View Profile
Re: Play Sound When clicking an Image
« Reply #4 on: October 10, 2008, 04:29:28 PM »
<embed src='.wav' autostart='true' loop='false'
width='2' height='0'>
</embed>

i found that ERMMMMM thats called PHP!!!!
It's do or do not do! There is no try! - Yoda

It's all in your <head>!

Remember for safe web programming always use protection, use a COMMA! :D

Offline thebadbad

  • Addict
  • Posts: 1,610
  • Gender: Male
  • $me = str_replace($question, $answer, $post);
    • View Profile
Re: Play Sound When clicking an Image
« Reply #5 on: October 10, 2008, 04:31:37 PM »
Nope, got that wrong mate ::) That's HTML.

Online KevinM1

  • Global Moderator
  • Fanatic
  • *
  • Posts: 3,911
  • Gender: Male
    • View Profile
Re: Play Sound When clicking an Image
« Reply #6 on: October 10, 2008, 04:35:03 PM »
Nope, got that wrong mate ::) That's HTML.

Not only that, but that audio file will start automatically when the page is viewed, not when an image is clicked.
Don't go to w3schools.  Here's why
Every time a PHP coder uses 'global' a kitten dies.

Offline discomatt

  • Addict
  • Posts: 1,936
  • Gender: Male
    • View Profile
Re: Play Sound When clicking an Image
« Reply #7 on: October 10, 2008, 04:35:22 PM »
<embed src='.wav' autostart='true' loop='false'
width='2' height='0'>
</embed>

i found that ERMMMMM thats called PHP!!!!

That is pretty damn awesome.

Online KevinM1

  • Global Moderator
  • Fanatic
  • *
  • Posts: 3,911
  • Gender: Male
    • View Profile
Re: Play Sound When clicking an Image
« Reply #8 on: October 10, 2008, 04:35:52 PM »
<embed src='.wav' autostart='true' loop='false'
width='2' height='0'>
</embed>

i found that ERMMMMM thats called PHP!!!!

That is pretty damn awesome.

*snicker*
Don't go to w3schools.  Here's why
Every time a PHP coder uses 'global' a kitten dies.

Offline Maq

  • Global Moderator
  • 'Insane!'
  • *
  • Posts: 11,004
  • Gender: Male
    • View Profile
    • Top Ecigs Reviews
Re: Play Sound When clicking an Image
« Reply #9 on: October 10, 2008, 04:41:05 PM »
Quote
<embed src='.wav' autostart='true' loop='false'
width='2' height='0'>
</embed>

i found that ERMMMMM thats called PHP!!!!

wtf, this kid needs more than just PHP help...
Electronic Cigarette Reviews - Smoking alternatives, find YOUR ecig!
ini_set ("display_errors""1");
error_reporting(E_ALL);

Offline dennismonsewicz

  • Devotee
  • Posts: 1,135
  • Gender: Male
    • View Profile
    • http://www.dennismonsewicz.com
Re: Play Sound When clicking an Image
« Reply #10 on: October 10, 2008, 04:52:19 PM »
little orphan annie called... the sun will not come out tomorrow!

Any takers?
To avoid multiple pages... use a switch!
Yeah, I drive a dodge!

http://www.dennismonsewicz.com
http://www.party-gator.com

Online KevinM1

  • Global Moderator
  • Fanatic
  • *
  • Posts: 3,911
  • Gender: Male
    • View Profile
Re: Play Sound When clicking an Image
« Reply #11 on: October 10, 2008, 05:00:26 PM »
In all seriousness, PHP allows one to switch between scripting and outputting HTML in the same file.  Example:

Code: [Select]
<?php
   $title 
"testing";
?>


<html>
<head>
   <title><?php echo $title?></title>
</head>

<body>
   Wow, look, I'm normal text in an HTML document!
</body>
</html>

The colored bits are PHP.  The rest is HTML.  This file would be saved as something.php, but that doesn't change the fact that the black-and-white bits are HTML.
Don't go to w3schools.  Here's why
Every time a PHP coder uses 'global' a kitten dies.

Offline taith

  • Devotee
  • Posts: 1,498
  • Gender: Male
    • View Profile
Re: Play Sound When clicking an Image
« Reply #12 on: October 10, 2008, 08:53:05 PM »
comon kids... be nice...

and yes it is javascript :-)

Code: [Select]
<scr ipt>
function playSound(id){

 if(document.embeds) document.embeds["sound"+id].play();

}
</scr ipt>

<embed SRC="beep.wav" HIDDEN="TRUE" AUTOSTART="false" name="sound1" loop="false"></embed>

<a onclick="javascript:playSound('1');">play</a>
90% of computer issues exist between the seat, and the keyboard.

Offline DarkWater

  • Freak!
  • Posts: 6,158
  • Gender: Male
    • View Profile
Re: Play Sound When clicking an Image
« Reply #13 on: October 10, 2008, 11:20:50 PM »
<embed src='.wav' autostart='true' loop='false'
width='2' height='0'>
</embed>

i found that ERMMMMM thats called PHP!!!!

That is pretty damn awesome.

That made my day.
Info:Apache 2.2.4 | PHP 6.0.0-dev, PHP 5.2.4 | Ubuntu 8.04 | Age: 16 | Coding PHP and CSS+(X)HTML: 5-6 years | Feel free to PM me if you need help!
Αν χρειάζεσαι ένας μεταφραστής, μπορέις να μου μιλάς.  Μιλώ καλά.
Quote from: Crayon Violent
If you ask for a banana, would you expect someone to hand you an orange? Or a fork?  No you wouldn't, because you asked for a banana, and you expect them to understand that a banana is not an orange or a fork.  It's the same principle.

Offline dropfaith

  • Devotee
  • Posts: 1,114
  • Gender: Male
    • View Profile
    • dropfaith Productions
Re: Play Sound When clicking an Image
« Reply #14 on: October 10, 2008, 11:25:45 PM »
it makes my day that the user isnt on their first post to which to me indicates they have done some degree of coding in the past