日期:2014-05-16  浏览次数:20609 次

用bootstrap的时候不能获取text的焦点!
http://pan.baidu.com/share/link?shareid=2370374828&uk=2687476845
我用bootstrap做模态对话框的时候,调用了2次对话框,即调用一个对话框以后,在这个对话框中再一次调用了一次模态对话框!但是其中出现了一些问题,就是第二次的模态对话框的文本框获取不到焦点!
文档我已经放在网盘,直接下解压就可以用!就是第二次的对话框中文本框不能获取焦点,但是复选框和单选框都是有用的!我知道是tabindex="-1"这个属性的问题!但是有没有人能解释这是为什么呀?为什么加了这个属性以后第二个对话框的文本框就不能获取焦点,但是其他的复选框,单选框能获取焦点?
  希望哪位大神能后,下载下来运行一下,这是为什么?
  如果不方便下载的话,那我这里把html的代码贴出来,但是bootstraps需要自己去下!html的代码如下
<html>
<meta charset="UTF-8">
<head>
<link rel="stylesheet" href="bootstrap.min.css">
</head>
<body>


<div class="modal hide fade" tabindex="-1"  id="first">
  <div class="modal-body">
   <input type="text">
    <button type="button" data-toggle="modal" data-target="#second">跳出第二个对话框</button>
  </div>
</div>


<div id="second" class="modal hide fade"  tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-body">
    文本框<input type="text">
   复选框 <input type="checkbox">
    单选框 <input type="radio">
  </div>
</div>

<button type="button" data-toggle="modal" data-target="#first">跳出第一个对话框</button>
<script src="http://code.jquery.com/jquery.js"></script>
    <script src="bootstrap.min.js"></script>
</body>
</html>

跪谢
bootstrap 焦点

------解决方案--------------------
好像是焦点死循环了
------解决方案--------------------
焦点死循环,只要按照你自己说的tabindex="-1",去掉这个就OK了!关于焦点死循环你可以查阅相关的只是来了解下!