2 回答

TA貢獻1836條經驗 獲得超13個贊
在輸出到頁面的最終 HTML 中(檢查 python 腳本生成的頁面以查找其內容),您可以添加自定義 js 片段以進一步修改 HTML,根據初始代碼輸出動態修改元素。
? ? ...template code above that contains yours {{=opt_sel}}...
? ? <!-- javascript snippet you add at bottom of page to change html above -->
? ? <script>
? ? ? ?document.querySelectorAll(".classOnABunchOfElementsMadeByOptSel > li").style.background = "red";
? ? ? ?document.querySelector("#secondElementMadeByOptSel").style.margin = "20px";
? ? </script>

TA貢獻1853條經驗 獲得超9個贊
只需將 _class 添加到 OPTION helper 參數列表中:
all_useroptions = []
for opt in db().select(db.useroptions.ALL):
? ? all_useroptions.append(OPTION(opt.symbol, _value=opt.id, _class='prettier'))
opt_sel = SELECT(*all_useroptions, _name='opt_id', value=request.vars.opt_id)
并根據您的喜好創建一個“更漂亮”的 CSS 定義
? ? *Named arguments that start with an underscore are interpreted as HTML tag attributes (without the underscore)*
- 2 回答
- 0 關注
- 139 瀏覽
添加回答
舉報