目前我正在开发Web辅助功能。因为我需要在键盘控件上完全访问我的项目。我已经尝试了很多来完成任务并参考W3c WAI-ARIA概念但是无法完成它。有人在这里指导我请参阅是否有任何教程是对我来说也没问题。
答案 0 :(得分:0)
使用以下javascript代码动态添加标签索引。
def t1():
print(1)
def t2():
print(2)
def t3():
print(3)
def t4():
print(4)
def t5():
print(5)
def t6():
print(6)
# put the functions in a list
functions = [t1, t2, t3, t4, t5, t6]
def go(functions):
# .format(variable) replaces {} with the value of variable (string formatting)
number_of_funcs = len(functions)
greeting = "Type a number from 1 to {}: ".format(number_of_funcs)
selected = input(greeting)
try:
# index to start from
index = int(selected) - 1
except ValueError:
# check if the user wrote a number (exception handling)
print('Invalid input. Not a number')
return
if index > number_of_funcs - 1 or index < 0:
msg = 'Invalid input. Consider a number from 1 to {}'.format(number_of_funcs)
print(msg)
return
# iterate through the functions of the list
# starting from the index specified (list slicing)
for f in functions[index:]:
f()
while(True):
# infinite loop. press Ctrl+C to abort
go(functions)