辅助功能,当在我的图像上按 Enter 时,屏幕会重新加载
我正在尝试转换我的 JS 代码,以便我可以通过 Tab 键浏览它并按 Enter 键来显示时间打孔。然而,在我将其转换为按钮后,它不再按照预期的方式运行。每当我在图像上按 Enter 时,它都会重新加载整个页面。我在这里做错了什么?
原始代码
<img tal:condition="python:len(punches)>0" onclick="toggleVisibilityByRow('Swipe_line')"
ref="javascript:void(0);" src="/AcuStaf/images/fold.gif" id="img_Swipe_line" class="clickable" />
<span tal:condition="float_swipes" id="swipe_float_units" style="display:none">
<span style="font-weight:bold">Float to </span>
<span tal:replace="structure python:container.util.getUnitSelects(my_form='swipe_form', my_var='float_unit', my_var_value='', unit_type='sch_unit', multiunit=False, use_unit_default=False, text_input=True)"></span>
<input type="button" data-inline="true" data-mini="true" onclick="jQuery('#float_unit').attr('disabled','disabled'); jQuery('#swipe_float_units').hide(); jQuery('#float_swipes_button').show()" style="margin-left:3em" title="Float to a alternate location or work" value="Remove Float" />
<br/>
<span style="font-weight:bold"> </span>
</span>
转换为可访问性按钮
<button class="blend" onclick="toggleVisibilityByRow('Swipe_line')"
title="Show time punches">
<img src="/AcuStaf/images/fold.svg"
id="img_Swipe_line" class="clickable" alt=">" tal:condition="python:len(punches)>0" ref="javascript:void(0);">
</button>
<span tal:condition="float_swipes" id="swipe_float_units" style="display:none">
<span style="font-weight:bold">Float to </span>
<span tal:replace="structure python:container.util.getUnitSelects(my_form='swipe_form', my_var='float_unit', my_var_value='', unit_type='sch_unit', multiunit=False, use_unit_default=False, text_input=True)"></span>
<input type="button" data-inline="true" data-mini="true" onclick="jQuery('#float_unit').attr('disabled','disabled'); jQuery('#swipe_float_units').hide(); jQuery('#float_swipes_button').show()" style="margin-left:3em" title="Float to a alternate location or work" value="Remove Float" />
<br/>
<span style="font-weight:bold"> </span>
</span>
我在“nbsp;”之后没有更改任何内容只是提供它以备不时之需。
I'm trying to convert my JS code in order for me to tab through it and press Enter to show time punches. However after I converted it into a button it stops behaving the way it was suppose to. Whenever I press Enter on the image it reloads the whole page. What did I do wrong here?
Original code
<img tal:condition="python:len(punches)>0" onclick="toggleVisibilityByRow('Swipe_line')"
ref="javascript:void(0);" src="/AcuStaf/images/fold.gif" id="img_Swipe_line" class="clickable" />
<span tal:condition="float_swipes" id="swipe_float_units" style="display:none">
<span style="font-weight:bold">Float to </span>
<span tal:replace="structure python:container.util.getUnitSelects(my_form='swipe_form', my_var='float_unit', my_var_value='', unit_type='sch_unit', multiunit=False, use_unit_default=False, text_input=True)"></span>
<input type="button" data-inline="true" data-mini="true" onclick="jQuery('#float_unit').attr('disabled','disabled'); jQuery('#swipe_float_units').hide(); jQuery('#float_swipes_button').show()" style="margin-left:3em" title="Float to a alternate location or work" value="Remove Float" />
<br/>
<span style="font-weight:bold"> </span>
</span>
Converting to button for accessibility
<button class="blend" onclick="toggleVisibilityByRow('Swipe_line')"
title="Show time punches">
<img src="/AcuStaf/images/fold.svg"
id="img_Swipe_line" class="clickable" alt=">" tal:condition="python:len(punches)>0" ref="javascript:void(0);">
</button>
<span tal:condition="float_swipes" id="swipe_float_units" style="display:none">
<span style="font-weight:bold">Float to </span>
<span tal:replace="structure python:container.util.getUnitSelects(my_form='swipe_form', my_var='float_unit', my_var_value='', unit_type='sch_unit', multiunit=False, use_unit_default=False, text_input=True)"></span>
<input type="button" data-inline="true" data-mini="true" onclick="jQuery('#float_unit').attr('disabled','disabled'); jQuery('#swipe_float_units').hide(); jQuery('#float_swipes_button').show()" style="margin-left:3em" title="Float to a alternate location or work" value="Remove Float" />
<br/>
<span style="font-weight:bold"> </span>
</span>
I did not change anything after "nbsp;" just providing it in case it matters.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论