日期选择器在Internet Explorer 11中不起作用.javascript用于日期选择器 [英] The date picker does not work in internet explorer 11. javascript is used for date picker

查看:101
本文介绍了日期选择器在Internet Explorer 11中不起作用.javascript用于日期选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

function show_calendar(){

var gNow = new Date();

var ReturnItem = arguments [0];

if( arguments [1] == null)

inMonth = new String(gNow.getMonth()+ 1);

else

inMonth = arguments [1];

if(arguments [2] == null)

inDay = new String(gNow.getDate());

否则

inDay = arguments [2];

if(arguments [3] == null)

inYear = new String(gNow.getYear ());

else

inYear = arguments [3];

var scpHeader =script;

var scpLanguage =JavaScript;

var scpDash = - ;

var winProps =toolbar = no,location = no,direction = no,status = no ,menubar = no,scrollbars = no,resizable = no,width = 165,height = 165,left =+ StartLeft +,top =+ StartTop;



wCal = window.open('','winCalendar',winProps);

wCal.opener = self;

wCal.document.writeln('< html> < META HTTP-EQUI V =Content-Typecontent =text / html; charset = iso-8859-1>< META HTTP-EQUIV =Expirescontent =<%= Now%>>< TITLE>选择日期< / TITLE>');

wCal.document.writeln('< BODY Style =background-repeat:no-repeat; background-position:center;bgcolor =whitebackground =/ graphics / sbc_color_med.gifbgproperties = fixed topmargin = 0 leftmargin = 0>');

wCal.document.writeln('');

wCal.document.writeln('<'+ scpHeader +'language ='+ scpLanguage +'FOR =Calendar1EVENT =Click()>');

wCal.document.writeln('<!'+ scpDash + scpDash);

wCal.document.writeln('ReturnDate = this.month +/+ this.day + /\"+this.year;');

wCal.document.writeln('self.opener.document。'+ ReturnItem +'。value = ReturnDate;');

wCal.document.writeln('self.opener.document。'+ ReturnItem +'。select();');

wCal.document.writeln(' self.opener.document。'+ ReturnItem +'。focus();');

wCal.document.writeln('self.close();');

wCal.document.writeln('\ / \ /'+ scpDash + scpDash +'>');

wCal.document.writeln('< \ /'+ scpHeader + '>');

wCal.document.writeln('

');

wCal.document.writeln('< object id = Calendar1 classid = clsid:8E27C92B-1264-101C-8A2F-040224009C02 width = 165 height = 165>');

wCal.document.writeln('< param name =Yearvalue ='+ inYear + '/>');

wCal.document.writeln('< param name =Monthvalue ='+ inMonth +'/>');

wCal.document.writeln('< param name =Dayvalue ='+ inDay +'/>');

wCal.document.writeln('< /对象>< / body>< / html>');

wCal.document.close();

}

function show_calendar() {
var gNow = new Date();
var ReturnItem = arguments[0];
if (arguments[1] == null)
inMonth = new String(gNow.getMonth()+1);
else
inMonth = arguments[1];
if (arguments[2] == null)
inDay = new String(gNow.getDate());
else
inDay = arguments[2];
if (arguments[3] == null)
inYear = new String(gNow.getYear());
else
inYear = arguments[3];
var scpHeader = "script";
var scpLanguage = "JavaScript";
var scpDash = "-";
var winProps = "toolbar=no,location=no,direction=no,status=no,menubar=no,scrollbars=no,resizable=no,width=165,height=165,left=" + StartLeft + ",top=" + StartTop;

wCal = window.open('','winCalendar',winProps);
wCal.opener = self;
wCal.document.writeln('<html><META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"><META HTTP-EQUIV="Expires" content="<%=Now%>"><TITLE>Select Date</TITLE>');
wCal.document.writeln('<BODY Style="background-repeat:no-repeat;background-position:center;" bgcolor="white" background="/graphics/sbc_color_med.gif" bgproperties=fixed topmargin=0 leftmargin=0>');
wCal.document.writeln('');
wCal.document.writeln('<' + scpHeader + ' language="' + scpLanguage + '" FOR="Calendar1" EVENT="Click()">');
wCal.document.writeln('<!' + scpDash + scpDash);
wCal.document.writeln(' ReturnDate = this.month+"/"+this.day+"/"+this.year;');
wCal.document.writeln(' self.opener.document.' + ReturnItem + '.value = ReturnDate;');
wCal.document.writeln(' self.opener.document.' + ReturnItem + '.select();');
wCal.document.writeln(' self.opener.document.' + ReturnItem + '.focus();');
wCal.document.writeln(' self.close();');
wCal.document.writeln('\/\/' + scpDash + scpDash + '>');
wCal.document.writeln('<\/' + scpHeader + '>');
wCal.document.writeln('

');
wCal.document.writeln('<object id=Calendar1 classid=clsid:8E27C92B-1264-101C-8A2F-040224009C02 width=165 height=165>');
wCal.document.writeln('<param name="Year" value="'+inYear+'" />');
wCal.document.writeln('<param name="Month" value="'+inMonth+'" />');
wCal.document.writeln('<param name="Day" value="'+inDay+'" />');
wCal.document.writeln('</object></body></html>');
wCal.document.close();
}

推荐答案

为日历使用ActiveX控件是除了Windows上的Internet Explorer之外,它不会工作。用户还需要安装ActiveX控件,并可能需要更改其安全设置。



尝试使用众多Javascript日期选择器中的一个不要依赖ActiveX控件。例如: http://jqueryui.com/datepicker/ [ ^ ]
Using an ActiveX control for your calendar isn't going to work in anything other than Internet Explorer on Windows. The user will also need to have the ActiveX control installed, and will potentially need to change their security settings.

Try using one of the many Javascript date pickers which don't rely on an ActiveX control. For example: http://jqueryui.com/datepicker/[^]


这篇关于日期选择器在Internet Explorer 11中不起作用.javascript用于日期选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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