刷新页面后的光标位置 [英] Cursor Position after refresh page

查看:183
本文介绍了刷新页面后的光标位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

刷新页面后,光标位置出现问题.

这是JS

Hi guys..

I have problem with my cursor position after refresh my page.

Here is JS

function checkAvaib()
{
    var x=document.getElementById("form");
    x.action="student_new.php";
    x.target="_self";
    x.submit();
}



这是HTML



Here is HTML

<input type="text" name="user_id" id="user_id" maxlength="10" value="<?php echo $_REQUEST["user_id"];?>"  önblur="checkAvaib()" tabindex="15"/>

<input type="text" name="name" id="name"  value="<?php echo $_REQUEST["name"];?>" tabindex="16"/>



当我开始时,在 user_id 字段中输入,然后跳至下一个字段(名称).它将刷新页面和光标位置,并转到第一个标签/字段.
刷新后是否可以将光标指向下一个选项卡/字段?

预先感谢.



When I start enter at user_id field and then tab to the next field(name). It will refresh the page and cursor position going to the first tab/field.
Is it possible to point the cursor to the next tab/field after refresh?

Thanks in advance.

推荐答案

_REQUEST ["user_id"];?>önblur=" checkAvaib()"tabindex =" 15"/> < input type ="text" name ="name" id ="name" value =<?php echo
_REQUEST["user_id"];?>" önblur="checkAvaib()" tabindex="15"/> <input type="text" name="name" id="name" value="<?php echo


_REQUEST [" name];?>" tabindex ="16"/>
_REQUEST["name"];?>" tabindex="16"/>



当我开始时,在 user_id 字段中输入,然后跳至下一个字段(名称).它将刷新页面和光标位置,并转到第一个标签/字段.
刷新后是否可以将光标指向下一个选项卡/字段?

预先感谢.



When I start enter at user_id field and then tab to the next field(name). It will refresh the page and cursor position going to the first tab/field.
Is it possible to point the cursor to the next tab/field after refresh?

Thanks in advance.


通常,您必须将这些内容保存在viewstate变量中,这些变量在回发后返回页面时要访问.
我不知道您是在提交到下一个控件时提交的,还是可以在页面上创建一些viewstate变量或会话或隐藏字段来记录您所在的控件.然后,在引荐之后,您便知道您所在的控件,并且可以将光标的焦点设置在刚录制的控件旁边.
In general you have to hold the things in a viewstate variables which you want to access when you come back on the page after post backs.

I dont know y are u submitting when you tab to next control, anyways you can make some viewstate variable or session or hidden field on your page that records the control you are at. then after the referesh you know which control you were at and you can set the focus of the cursor next to the control you just recorded.


这篇关于刷新页面后的光标位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆