or user jQuery(document).ready(function(){ *put code here });
That will get executed when all of the DOM has loaded on the page. -- Thadeus On Wed, Aug 18, 2010 at 10:19 AM, dlin <dlin...@gmail.com> wrote: > I solved the problem by myself. > > in my view file > <script>jQuery("#mytable tr:odd").css("background-color", > "#bbbbff");</script> > {{=mytable}} > > should changed to > > {{=mytable}} > <script>jQuery("#mytable tr:odd").css("background-color", > "#bbbbff");</script> > > Because the #mytable id is defined after mytable displayed. > > On 8月17日, 下午2時27分, dlin <dlin...@gmail.com> wrote: >> unfortunately, I've tried again. it still not work. Or, is there any >> open sample code could let me see? >> >> I've add another line in layout.html, but still failed. >> >> controllers/default.py >> ------------------------ >> mytable = SQLTABLE(...) >> mytable['_id'] = 'mytable' >> >> views/default/layout.html >> ------------------------ >> {{extend 'layout.html'}} >> <script>jQuery("tr:even").css("background-color", "#bbbb00");</ >> script> >> <script>jQuery("#mytable tr:odd").css("background-color", >> "#bbbbff");</ >> script> >> {{=mytable}} >> >> views/default/layout.html, add a line in <head>, but still failed >> ------------------------ >> <script>jQuery("tr:even").css("background-color", "#bbbb00");</ >> >> On Aug 13, 5:20 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: >> >> > mytable['_id']='mytable' >> >> > <script>jQuery("#mytable tr:odd").css("background-color", "#bbbbff");</ >> > script> >> >> > will only do your table (mytable). >> >> > On Aug 13, 4:14 am, "Robert O'Connor" <robby.ocon...@gmail.com> wrote: >> >> > > Or if the browser supports >> > > CSS3:http://www.w3.org/TR/css3-selectors/#nth-child-pseudo >> >> > > that works -- but it styles *ALL* tables... be warned :) >> >> > > -Rob >> >> > > On Fri, Aug 13, 2010 at 5:09 AM, mdipierro <mdipie...@cs.depaul.edu> >> > > wrote: >> > > > Add something like this to the view (or the layout): >> >> > > > <script>jQuery("tr:odd").css("background-color", "#bbbbff");</script> >> >> > > > On Aug 13, 4:05 am,dlin<dlin...@gmail.com> wrote: >> > > >> I want to change the layout of the displayed form which is produced by >> > > >> SQLTABLE and named as mytable. >> >> > > >> 1 x >> > > >> 2 a >> > > >> 3 b >> > > >> 4 c >> > > >> 5 d >> > > >> 6 e >> >> > > >> I wish the odd lines and even lines have different background (in .css >> > > >> instead of server side operation). >> > > >> Is there any one here know how to do it? >> >> > > >> I wish the views/default/index.html could be easier like >> >> > > >> {{=mytable}} // this table require odd & even have different >> > > >> background color. >> > > >> {{=mytable2}} // this table just use the default table view >> >> > > >> But, I don't understand how to do it, how to fine tune the output >> > > >> table's width,border with the .css client side tech. >