Try:

*return XML("<script>$('%s').click(function(){$('html, body,
%s').animate({scrollTop:
$(document).height()}, %s); return false;});</script>" %
(**button_id,div_id,speed
)*

Regards, Martin


2012/6/4 Hassan Alnatour <[email protected]>

> Dear ALL ,
>
>  I created a function to get a div and a button and a speed and then using
> jquery scroll down to that div , now the function looks like this  :
>
> *def scrolldown(button_id,div_id,speed):
>     '''
>     Scroll down to the end of any div using a button and a speed
>     '''
>     return XML("<script>$('%s').click(function(){$('html, body, 
> %s').animate({scrollTop:
> $(document).height()}, %s); return false;});</script>" %
> button_id,div_id,speed
>
>
> *
>  i used that function in the view like this  :
>
> *{{=scrolldown('#s','.rounded','60000')}}
>
>
>
> *
>   But i keep getting an Error which is : *not enough arguments for format
> string  !! *Why *??
>
> <type 'exceptions.TypeError'>(not enough arguments for format string)
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 204, in restricted
>     exec ccode in environment
>   File "C:\web2py\applications\i3zif\views\arabic/usercontest.html", line
> 192, in <module>
>   File "C:/web2py/applications/i3zif/models/scrolldown.py", line 6, in
> scrolldown
>     return XML("<script>$('%s').click(function(){$('html, body,
> %s').animate({scrollTop: $(document).height()}, %s); return
> false;});</script>" % button_id,div_id,speed)
> TypeError: not enough arguments for format string
>
> *
>
>
>

Reply via email to