• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

在iframe中使用带iframe的日历组件

发布: 2007-6-08 22:43 | 作者: seanhe | 来源: 互连网

软件测试论坛讨论

领测软件测试网

1.把梅花雨的日历组件加了句代码:
function returnDate() //根据日期格式等返回用户选定的日期
{
    if(WebCalendar.objExport)
    {
        var returnValue;
        var a = (arguments.length==0) ? WebCalendar.day[this.id.substr(8)].split("/") : arguments[0].split("/");
        var d = WebCalendar.format.match(/^(\w{4})(-|\/)(\w{1,2})\2(\w{1,2})$/);
        if(d==null){alert("你设定的日期输出格式不对!\r\n\r\n请重新定义 WebCalendar.format !"); return false;}
        var flag = d[3].length==2 || d[4].length==2; //判断返回的日期格式是否要补零
        returnValue = flag ? a[2] +d[2]+ appendZero(a[1]) +d[2]+ appendZero(a[0]) : a[2] +d[2]+ a[1] +d[2]+ a[0];
        if(WebCalendar.timeShow)
        {
            var h = new Date().getHours(), m = new Date().getMinutes(), s = new Date().getSeconds();
            returnValue += flag ? " "+ appendZero(h) +":"+ appendZero(m) +":"+ appendZero(s) : " "+  h  +":"+ m +":"+ s;
        }
        WebCalendar.objExport.value = returnValue;
//---------------下面这句-----------------------------------
        WebCalendar.objExport.onblur();//加上失去目标对象失去焦点事件--针对iframe中的引用
//----------------------------------------------------------
        hiddenCalendar();
    }
}

2.iframe里面的调用不变:
<INPUT maxLength=10 name=startDate size=10 onfocus="javascript:top.document.all.tempdate1.focus();">

3.调用页
<input name="tempdate1" onfocus="javascript:calendar();" onblur="javascript:go2startdate(this.value);" style="BACKGROUND: #fffff;width:1px;height=1px;">

<script language="javascript">
function go2startdate(o)
{
document.frames("frameID").document.formName.startDate.value=o;
}
</script>

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网