i have used xhtml method and html5 method in both cases when i tap on
the link the audio file does not play in the background instead the
audio file plays in an audio app and after playing the sound i have to
click on Done button and then the html page appears

following are the different methods i have used

1
<a href="#" onclick="playsound1('sound1')">Play Audio</a>

<embed src="audio.mp3" autostart="true" id="sound1" width="0"
height="0" hidden="true">

function playsound1(soundobj){
        var thissound1=document.getElementById(soundobj);
        thissound1.Play();
}

2
<a href="#" onclick="playsound2()">Play Audio</a>

<embed src="audio.mp3" autostart="true" id="sound2" width="0"
height="0" hidden="true">

function playsound2(){
        var thissound2=document.getElementById("sound2");
        thissound2.Play();
}

i have used html5 audio tag with zepto framework 
https://github.com/madrobby/zepto#readme

 <div id="touch_test"><a href="#" id="audio">play audio</a></div>
  <script>
    $("#audio").tap(function(){
        $("#touch_test").append('<audio src="success-mp3.mp3"
autoplay="autoplay"></audio> ');
      });
  </script>

what i need is when a link is clicked i want a background sound to
play immediately and this sound file is only few seconds and this
sound should play inside the html page and not open in a separate
audio app i want the html page to stay the way it is.

i want this feature only using html, css and javascript not in xcode

also i am using iphone 2g does 2g have limitations regarding the code
i am using

On Jan 7, 6:19 am, Giacomo Balli <[email protected]> wrote:
> add it to the onclick function.
> otherwise, if you want a full solution, intercept all clicks and edit
> the behavior.
>
> On Jan 6, 2:18 pm, Sudhakar <[email protected]> wrote:
>
>
>
>
>
>
>
> > i would like to use an app when i tap on a button when this event
> > occurs only i would like an audio file to play which is only for 2-3
> > seconds like a beep sound
>
> > using html and javascript only and not in xcode how can i use an event
> > so that when i tap on a button i can call a javascript function which
> > will play the audio file for few seconds

-- 
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en.

Reply via email to