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 <sababa.sab...@gmail.com>

> 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

Reply via email to