You can use the new audio tag from HTML5, but this should not work on every
browser
<audio src="{{=URL('static',args='horse.ogg')}}" controls="controls">
Your browser does not support the audio element.
</audio>
2010/9/24 Rick <[email protected]>
> Thanks!
>
> I think there are better plugins for this purpose than this sound-
> plugin. But now I know how to install it into my application.
>
> On Sep 24, 8:26 pm, Bruno Rocha <[email protected]> wrote:
> > You should append JS files before the {{include 'web2py_ajax.html'}}
> >
> > views/layout.html:
> > <head>
> >
> > {{response.files.append(URL(r=request,c='static',f='jquery.sound.js'))}}
> > ....
> > {{include 'web2py_ajax.html'}}
> > </head>
> >
> > and in your div the OnClick event is used in the wrong way, it is not
> > recommended to use onclick event in a div, you should use <a>,<span> or
> > another element, and the file URL should be build with URL helper:
> >
> > views/default/index.html:
> > {{extend 'layout.html'}}
> > <div>
> > <span
> >
> >
> onclick="jQuery(this).sound.play({{=URL('static',args='success.wav')}})">
> > Click here to listen the sound
> > </span>
> > </div>
> >
> > 2010/9/24 Rick <[email protected]>
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > I'd like to make a button that generates a sound when clicking on it.
> > > This JQuery plugin was the best way I could found:
> > >http://plugins.jquery.com/project/sound
> > > and I wrote this code:
> >
> > > views/default/index.html:
> > > {{extend 'layout.html'}}
> > > <div>
> > > onClick="jQuery(this).sound.play(/static/success.wav)"
> > > </div>
> >
> > > views/layout.html:
> > > <head>
> >
> > >
> {{response.files.append(URL(r=request,c='static',f='jquery.sound.js'))}}
> > > </head>
> >
> > > Since I'm totally new to JQuery I understand that this is completely
> > > wrong. Could anyone tell me how it should look like, please?
> >
> > --
> >
> > http://rochacbruno.com.br
>
--
http://rochacbruno.com.br