`
webcode
  • 浏览: 5942733 次
  • 性别: Icon_minigender_1
  • 来自: 上海
文章分类
社区版块
存档分类
最新评论

无刷新点文本框,自动出现下拉框

阅读更多
<html>
<head>
<title>add</title>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<scripttype="text/javascript">

functionShowName(sName)
{
document.getElementById('sel_class').value=sName;
}
functionDiv()
{
this.obj=null;
this.objWidth=0;
this.objHeight=0;
this.IntervalID=null;
this.bProcessing=false;
this.bOpen=false;
this.nStep=12;

this.Init=function(sValue)
{
if(!this.obj)return;
this.obj.innerHTML=sValue;
this.obj.style.display='none';
this.obj.style.position='absolute';
this.obj.style.overflow='hidden';
}
this.Show=function()
{
if(!this.bProcessing&&!this.bOpen)
{
if(!this.obj)return;
this.obj.style.width='0px';
this.obj.style.height='0px';
this.obj.style.display='block';
this.obj.style.zIndex='1';
varself=this;
this.IntervalID=setInterval(function(){self.DoShow();},10);
this.bProcessing=true;

//隐藏select
varoSel=document.getElementsByTagName('select');
for(i=0;i<oSel.length;i++)
{
//oSel[i].style.visibility='hidden';
}
}
}
this.DoShow=function()
{
varnWidth=this.obj.offsetWidth;
varnHeight=this.obj.offsetHeight;
varnPerX=this.nStep;
varnPerY=nPerX/(this.objWidth/this.objHeight);
varnTempX=nWidth+nPerX;
varnTempY=nHeight+nPerY;
this.obj.style.width=nTempX+"px";
this.obj.style.height=nTempY+"px";
if(this.obj.offsetWidth>=this.objWidth||this.obj.offsetHeight>=this.objHeight)
{
this.obj.style.width=this.objWidth+"px";
this.obj.style.height=this.objHeight+"px";
clearInterval(this.IntervalID);
this.IntervalID=null;
this.bProcessing=false;
this.bOpen=true;
}
}

this.Close=function()
{
if(!this.bProcessing&&this.bOpen)
{
if(!this.obj)return;
varself=this;
this.IntervalID=setInterval(function(){self.DoClose();},10);
this.bProcessing=true;
}
}

this.DoClose=function()
{
varnWidth=this.obj.offsetWidth;
varnHeight=this.obj.offsetHeight;
varnPerX=this.nStep;
varnPerY=nPerX/(this.objWidth/this.objHeight);
varnTempX=nWidth-nPerX;
varnTempY=nHeight-nPerY;
if(nTempX>0&&nTempY>0)
{
this.obj.style.width=nTempX+"px";
this.obj.style.height=nTempY+"px";
}
else
{
this.obj.style.display='none';
clearInterval(this.IntervalID);
this.IntervalID=null;
this.bProcessing=false;
this.bOpen=false;

//显示select
varoSel=document.getElementsByTagName('select');
for(i=0;i<oSel.length;i++)
{
oSel[i].style.visibility='visible';
}
}
}
}
</script>
</head>
<body>
<tablecellspacing="0"cellpadding="0"width="98%"align="center"border="0">
<tbody>
<tr>
<tdclass="show_main">
<formonsubmit="returncheck()"action="?action=save"method="post">
<tablecellspacing="1"cellpadding="0"width="100%"border="0">
<tbody>
<tr>
<tdid="errormsg"colspan="2">
</td>
</tr>
<tr>
<tdclass="form_label">
<labelfor="sel_class">
select</label>
</td>
<tdclass="form_input">
<inputclass="text"id="sel_class"onclick="oClassDiv.Show()"value="">
<divid="class">
</div>
<scripttype="text/javascript">
varsHTML="<divstyle=\"width:200px;height:250px;border:1pxsolid#000;background-color:#fff;position:absolute;left:0px;top:0px;cursor:default\">";
sHTML+="<divstyle=\"height:20px;line-height:20px;color:#fff;background-color:#a00d06;padding-left:12px;font-weight:bold;\">";
sHTML+="select<spanstyle=\"cursor:pointer;font-weight:normal;\"onclick=\"oClassDiv.Close();\">[close]</span></div>";
sHTML+="<divstyle=\"height:230px;line-height:20px;overflow-y:scroll;\"><ulstyle=\"list-style:none;margin:0;\">";
sHTML+="<listyle='padding-left:12px;'><inputtype=radioname=class_idvalue=7onclick='ShowName(\"11111\")'/>job</li>";
sHTML+="<listyle='padding-left:12px;'><inputtype=radioname=class_idvalue=1onclick='ShowName(\"22222\")'/>james</li>";
sHTML+="<listyle='padding-left:12px;'><inputtype=radioname=class_idvalue=2onclick='ShowName(\"33333\")'/>kobi</li>";
sHTML+="<listyle='padding-left:12px;'><inputtype=radioname=class_idvalue=3onclick='ShowName(\"44444\")'/>oneal</li>";
sHTML+="</ul></div>";
sHTML+="</div>";
varoClassDiv=newDiv();
oClassDiv.objWidth=202;
oClassDiv.objHeight=252;
oClassDiv.obj=document.getElementById('class');
oClassDiv.Init(sHTML);
</script>
</td>
</tr>
</tbody>
</table>
</form>
</td>
</tr>
</tbody>
</table>
</body>
</html>
分享到:
评论

相关推荐

    在jquery repeater中添加设置日期,下拉,复选框等控件

    如果, 有不明白的问题, 请先阅读 30 分钟掌握无刷新 Repeater. 示例代码下载: http://zsharedcode.googlecode.com/files/JQueryElementDemo.rar 本文将详细的讲解 Repeater 控件的模板中如何处理控件, 目录如下: * ...

    javascript代码常用大全

    一、验证类 1、数字验证内 1.1 整数 1.2 大于0的整数 (用于传来的ID的验证) 1.3 负整数的验证 1.4 整数不能大于iMax 1.5 整数不能小于iMin ...16, 刷新/模拟无刷新 异步调用类(XMLHttp或iframe,frame)

    javascript常用代码大全.html

    包括: 一、验证类 1、数字验证内 1.1 整数 1.2 大于0的整数 (用于传来的ID的验证) 1.3 负整数的验证 1.4 整数不能大于iMax 1.5 整数不能小于iMin ...16, 刷新/模拟无刷新 异步调用类(XMLHttp或iframe,frame)

    javascript 常用代码大全

    一、验证类 1、数字验证内 1.1 整数 1.2 大于0的整数 (用于传来的id的验证) 1.3 负整数的验证 1.4 整数不能大于imax 1.5 整数不能小于imin ...16, 刷新/模拟无刷新 异步调用类(xmlhttp或iframe,frame)

    javascript常用代码

    主要是以下功能的代码: 一、验证类 1、数字验证内 1.1 整数 1.2 大于0的整数 (用于传来的id的验证) 1.3 负整数的验证 1.4 整数不能大于imax ...16, 刷新/模拟无刷新 异步调用类(xmlhttp或iframe,frame)

    《程序天下:JavaScript实例自学手册》光盘源码

    1.3 页面自动刷新 1.4 页面的后退、刷新、前进 1.5保护网页源代码 1.6 保护自己的网页不被放入框架 1.7 保护自己的网页不被放入框架 1.8 打印页面的出错原因 1.9 当前网页调用其他网页 1.10 倒计时载入页面 1.11 ...

    程序天下:JavaScript实例自学手册

    1.3 页面自动刷新 1.4 页面的后退、刷新、前进 1.5保护网页源代码 1.6 保护自己的网页不被放入框架 1.7 保护自己的网页不被放入框架 1.8 打印页面的出错原因 1.9 当前网页调用其他网页 1.10 倒计时载入页面 1.11 ...

    风越.Net代码生成器 [FireCode Creator] V1.3 精简版

    添加、修改页面提交后自动跳转并刷新列表页 字段描述批量格式化,可从字段名、描述生成,加强英文字符处理 列表、搜索页面隔行颜色、点击变色设置 根据数据库字段允许空值状态自动设置输入检测代码 页面皮肤...

    风越.net代码生成器 v3.5

    添加、修改页面提交后自动跳转并刷新列表页 字段描述批量格式化,可从字段名、描述生成,加强英文字符处理 列表、搜索页面隔行颜色、点击变色设置 根据数据库字段允许空值状态自动设置输入检测代码 页面皮肤...

    风越asp代码生成器 V3.5

    添加、修改页面提交后自动跳转并刷新列表页 字段描述批量格式化,可从字段名、描述生成,加强英文字符处理 列表、搜索页面隔行颜色、点击变色设置 根据数据库字段允许空值状态自动设置输入检测代码 页面皮肤...

    风越ASP代码生成器 2.4

    添加、修改页面提交后自动跳转并刷新列表页 字段描述批量格式化,可从字段名、描述生成,加强英文字符处理 列表、搜索页面隔行颜色、点击变色设置 根据数据库字段允许空值状态自动设置输入检测代码 页面皮肤...

    风越ASP代码生成器FireAspCreatorv2.9.rar

    添加、修改页面提交后自动跳转并刷新列表页 字段描述批量格式化,可从字段名、描述生成,加强英文字符处理 列表、搜索页面隔行颜色、点击变色设置 根据数据库字段允许空值状态自动设置输入检测代码 页面皮肤模板设置...

    风越.net代码生成器v2.9

    添加、修改页面提交后自动跳转并刷新列表页 字段描述批量格式化,可从字段名、描述生成,加强英文字符处理 列表、搜索页面隔行颜色、点击变色设置 根据数据库字段允许空值状态自动设置输入检测代码 页面皮肤...

    风越ASP代码生成器2.8

    添加、修改页面提交后自动跳转并刷新列表页 字段描述批量格式化,可从字段名、描述生成,加强英文字符处理 列表、搜索页面隔行颜色、点击变色设置 根据数据库字段允许空值状态自动设置输入检测代码 页面皮肤...

    史上最强JavaScript日历控件正式版(无偿的永久的提供给大家免费使用,含全部源代码)

    这样一个页面中可以显示多种语言,多种皮肤的日期控件,更棒的是,他们之间的切换是无刷新的. 五、跨无限级框架显示和自动选择显示位置 无论你把日期控件放在哪里,你都不需要担心会被外层的iframe所遮挡进而影响客户...

    提单地点维护

    “提箱地点代码”:为下拉框,选项根据‘MSKEIR_I_DELIVERY_PLACE+location属性’匹配代码映射表的data_type+location,从而获取code,默认为选项起始值,无空选项 (2)船公司维护新规则完毕,点击“保存”按钮,...

    JQuery&CSS;&CSS;+DIV实例大全.rar

    1.JS+CSS仿腾讯QQ首页搜索框无刷新换肤效果代码 2.js+css简单后台二级树形菜单demo示例 3.JS+CSS美化经典Select选项框插件 4.JS+CSS通用一个页面同时三个焦点图轮换效果完整实例 5.JS+CSS网页版模拟QQ登录...

    ssm框架库存管理系统导入可用带sql

    2.CacheEvict:根据key删除redis中对应的数据,保证数据库在变更的时候达到刷新的效果 入库管理: 1货品入库登记 2鲜花展示(调的接口) 我在项目中主要负责入库管理,仓库租赁优惠管理,还有就是一个掉接口展示页面...

    js使用小技巧

    自动刷新 ;URL=http://c98.yeah.net"&gt; 简单邮件 &lt;a href="mailto:aaa@bbb.com?subject=ccc&body=xxxyyy"&gt; 快速转到位置 obj.scrollIntoView(true) 锚 &lt;a name="first"&gt; &lt;a href="#first"&gt;anchors 网页...

    《JavaScript实例精通》[源代码]

    18_7.htm 下拉框的值同时给文本框和文本域。 18_8.htm 基于jQuery的折叠菜单。 18_9.htm 可编辑的表格数据。 第19章(\19) 示例描述:其他特效。 19_1.htm 中文日期。 19_2.htm 现在的日期及星期。 19_3...

Global site tag (gtag.js) - Google Analytics