Do you mean that you want the code to appear on the webpage?
Save your code into a file in the static folder, and include in your views
file using response.files:
{{response.files.append(URL('static','js_folder/your_file.js'))}}
On Wednesday, November 7, 2012 5:39:36 PM UTC+8, Ali Alroomi wrote:
>
> hello plz i need help i need t write web2py code into javascript ike the
> following my code plz any help with the this:
>
>
> $.fn.fancybox = function(options) {
> $(this).data('fancybox', $.extend({}, options));
>
> $(this).unbind('click.fb').bind('click.fb', function(e) {
> e.preventDefault();
>
> if (busy) return;
>
> busy = true;
>
> $(this).blur();
>
> selectedArray = [];
> selectedIndex = 0;
> {{for i in db().select(db.Project.ALL):}}
> var rel = $(this).attr('rel') || '';
> var message = {{=i.CategoryID}};
> var url = "?pro=" + escape(message);
>
> if (!rel || rel == '' || rel === 'nofollow') {
> selectedArray.push(this);
>
> } else {
> selectedArray = $("a[rel=" + rel + "], area[rel=" + rel
> + "]");
> selectedIndex = selectedArray.index( this );
> /*window.open(url, "_self");*/
> history.replaceState({}, "Title", url);
>
>
> }
>
>
>
>
>
>
> fancybox_start();
>
> return false;
> });
>
> return this;
> };
>
--