我正在尝试向 Brython-HTML 第一列中的元素添加超链接:
这是 HTML 部分:
<div id="zone">Table</div>
这是 Brython 部分:
<script type="text/python" id="script7">
from browser import document
from browser.html import TABLE, TR, TH, TD
table = TABLE()
row = TR() # create a row
# add header cells
row <= TH("Header1")
row <= TH("Header2")
table <= row # add the row to the table
lines = [ ['Morrissey','vocals'],
['Johnny Marr','guitar'],
['Mike Joyce','the drums'],
['Andy Rourke','the bass guitar']
]
for line in lines:
table <= TR(TD(line[0], href='http://www.python.org')+TD(line[1]))
document['zone'].text = ''
document['zone'] <= table
</script>
我可以在浏览器中看到表格,但是没有超链接可以点击打开页面。
任何帮助,将不胜感激。
问候,贝鲁兹