就是亚洲土吧网-视频(www.tuba.asia)上公式计算时弹出的那个框的实现原理,谢谢;

解决方案 »

  1.   

    这个上(www.tuba.asia)我看过原码,应是用jquery实现的。我们公司不允许用jquery,所以想请问只用js能否实现,如果可以,请问要怎么做?谢谢;
      

  2.   

    无插件的弹出层 背景半透明,淡入淡出  支持 Alert Confirm 
      

  3.   


    <head>
        <title>无标题页</title>
    <script type="text/javascript" language="javascript">
    function showDiv(t){//文本框的onfocus事件把传入的参数是this,所以这里的t就是文本框
    var div = document.getElementById("div1");//这个div不是js生成的,已经是写好了的在body里面,只不过是隐藏的,看不见
    div.style.top=t.offsetTop+20; //t.offsetTop获得文本框在页面上的绝对高度,也就是距最顶端的距离,在加上20就是div出现时的位置(不加的话会把文本框遮蔽,你可以去掉看看),也就是高度。
    div.style.display="block";//将div显示
    }
    function hiddenDiv(){
    document.getElementById("div1").style.display="none";//隐藏div
    }
    </script>
    </head><body>
    <input type="text" id="txt" onfocus="showDiv(this);"  /><!--这里没什么好说的-->
    <div id="div1" style="background-color:#666666;width:90px;display:none;position:absolute;"> <!--注意这个position:absolute,加上这个,无论这个div有多大,他都会遮蔽其他的html元素。不加的话就会把其他html元素挤开,会影响样式,所以最好加上-->
      <input type="button" value="1"/><input type="button" value="2"/><input type="button" value="3"/><br/><input type="button" value="4"/><input type="button" value="5"/><input type="button" value="6"/><br/><input type="button" value="7"/><input type="button" value="8"/><input type="button" value="9"/><br/><input type="button" value="Submit" onclick="hiddenDiv();"/><!--submit隐藏掉div-->
      </div>
    </body>
    div里面的那些按钮你自己做一个click事件处理,将1 2 3写进文本框。这个很简单了,
    累了我半小时了,全手写,楼主不把分给我真是对不起天地良心
      

  4.   

    80分要给7楼的,tmd怎么到了6楼?有什么办法修改过来?
      

  5.   

    请kc0001x到此贴,我另给你原分,谢谢;
    http://topic.csdn.net/u/20101117/15/50197569-6b3b-470f-aae1-43d31e826992.html