点击按钮后让textarea获得焦点怎么实现

点击按钮后让textarea获得焦点怎么实现,第1张

定义和用法

focus() 方法用于在密码域上设置焦点

语法

passwordObjectfocus()

实例

下面的例子可设置或移开密码域上的焦点:

<html>

<head>

<script type="text/javascript">

function setFocus()

{

documentgetElementById('password1')focus()

}

function loseFocus()

{

documentgetElementById('password1')blur()

}

</script>

</head>

<body>

<form>

<input type="password" id="password1" value="thgrt456" />

<input type="button" onclick="setFocus()" value="Set focus" />

<input type="button" onclick="loseFocus()" value="Lose focus" />

</form>

</body>

</html>

1将ListView的Item Layout的子控件focusable属性设置为false

2对Item Layout的根控件android:descendantFocusability="blocksDescendant"

例如:

<RelativeLayout

xmlns:android=">

两种办法:

在Form_Load事件里写:

文本框的名称Focus();

或设置文本框的默认焦点:

选择TextBox后在属性窗口里把TabIndex设为0,如果不行那就设为1(前提是TabStop是True的)

以上就是关于点击按钮后让textarea获得焦点怎么实现全部的内容,包括:点击按钮后让textarea获得焦点怎么实现、关于ListView如何使其获得焦点、c#窗口启动 textbox怎么获取焦点等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9749940.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-01
下一篇2023-05-01

发表评论

登录后才能评论

评论列表(0条)

    保存