我的vs2003不能识别<button></button>控件,怎么解决呢?
在HTML spec 4.0里,增加了一个BUTTON元素,并且IE4.0就已经开始支持<BUTTON>了,
表达方式是<button><img align='absmiddle' src='/Emoticons/emnote.gif'>Sing Song</button>
我的vs不识别,该怎么办呢?
还有,我用这个button控件onfocus的函数编写的一段js脚本语句在我的本地机上可以实现,但是在别的机子上就不能实现,提示是"对像不支持该方法或属性",这是为什么啊?别的机子是不是没有编译器啊?还是什么原因啊?搞不清楚,大家帮忙
问题点数:20、回复次数:5Top
1 楼net_lover(【孟子E章】)回复于 2006-03-04 15:02:37 得分 0
<input type=button style="background:url('/Emoticons/emnote.gif')" value="ok">Top
2 楼net_lover(【孟子E章】)回复于 2006-03-04 15:03:07 得分 0
贴你 的js代码Top
3 楼yezhutou(向天朱)回复于 2006-03-04 15:11:17 得分 0
我这是一个三个页面的调用:
首先是calendar.aspx:
<object id=sptCal style="position: absolute; height: 0px; left: 0px; top: 0px; width: 0px; z-index: 101" type=text/x-scriptlet viewastext>
<param name="URL" value="../PublicAsp/UtlCalendar.aspx"></object>
</div>
<SCRIPT LANGUAGE=javascript>
<!--
var _Calendar_window_onload_timer = null
function _Calendar_window_onload()
{
if (_Calendar_window_onload_timer != null) window.clearTimeout(_Calendar_window_onload_timer);
try
{
sptCal.Initialize(sptCal);
}
catch(e)
{
_Calendar_window_onload_timer = window.setTimeout("_Calendar_window_onload()",500);
}
}
_Calendar_window_onload_timer = window.setTimeout("_Calendar_window_onload()",500);
//-->
</SCRIPT>Top
4 楼yezhutou(向天朱)回复于 2006-03-04 15:15:54 得分 0
Ultcalendar.aspx中的js代码是:
<script LANGUAGE="javascript">
<!--
var m_DateValue = "";
var m_self = "";
var m_MarkDiv = null;
var m_DateTextBox = null;
var m_DateBtn = null;
var m_disableFlag = false;
var m_ondblclick = null; // Event: Fire when double click
document.onselectstart = document_DisableSelect;
function document_DisableSelect()
{
return false;
}
function window_onload()
{
var strYear,strMonth,strDate,strDay;
var dtCurrent=new Date();
strYear= dtCurrent.getYear();
strMonth= dtCurrent.getMonth();
strDate= dtCurrent.getDate();
strDay= dtCurrent.getDay();//weekday 0 stand for Sunday
sltMonth.selectedIndex = strMonth;
window.txtYear.value=strYear;//set the year
//set the first day to the weekday
var iWeekDate,iHowManyDays,strTemp;
iWeekDate=(new Date(strYear,strMonth,1)).getDay();
strTemp=strMonth+1;
iHowManyDays=HowManyDays(strTemp,strYear);
setDaysToCalendar(iWeekDate,iHowManyDays,strDate);
m_DateValue=FormateDate(strYear,strTemp,strDate);
if (m_DateTextBox != null)
m_DateTextBox.value = m_DateValue;
}
function sleOnClick()
{
var strMonth;
var strYear;
var strDate;
var iWeekDate;
var iHowManyDays;
strYear=window.txtYear.value ;
strMonth=window.sltMonth.value ;
iWeekDate = (new Date(strYear,strMonth-1,1)).getDay();
iHowManyDays=HowManyDays(strMonth,strYear);
strDate=WhichDaySelected();
WriteNullToCalendar();
ResetbgColor();
setDaysToCalendar(iWeekDate,iHowManyDays,strDate);
m_DateValue=FormateDate(strYear,strMonth,strDate);
m_Self.style.height=tblTotalCalendar.clientHeight+2;
if (m_DateTextBox != null)
m_DateTextBox.value = m_DateValue;
}
var objLink;
function imgUpOnclick()
{
var strYear;
strYear=txtYear.value;
strYear=parseInt(strYear)+1;
if (strYear==100) strYear=2000;
txtYear.value=strYear;
strMonth=window.sltMonth.value ;
iWeekDate = (new Date(strYear,strMonth-1,1)).getDay();
iHowManyDays=HowManyDays(strMonth,strYear);
strDate=WhichDaySelected();
WriteNullToCalendar();
ResetbgColor();
setDaysToCalendar(iWeekDate,iHowManyDays,strDate);
m_DateValue=FormateDate(strYear,strMonth,strDate);
m_Self.style.height=tblTotalCalendar.clientHeight+2;
if (m_DateTextBox != null)
m_DateTextBox.value = m_DateValue;
}
function imgDownOnclick()
{
var strYear;
strYear=txtYear.value;
strYear=parseInt(strYear)-1;
txtYear.value=strYear;
strMonth=window.sltMonth.value ;
iWeekDate = (new Date(strYear,strMonth-1,1)).getDay();
iHowManyDays=HowManyDays(strMonth,strYear);
strDate=WhichDaySelected();
WriteNullToCalendar();
ResetbgColor();
setDaysToCalendar(iWeekDate,iHowManyDays,strDate);
m_DateValue=FormateDate(strYear,strMonth,strDate);
m_Self.style.height=tblTotalCalendar.clientHeight+2;
if (m_DateTextBox != null)
m_DateTextBox.value = m_DateValue;
}
function txtYearOnchange()
{
var strYear,strMonth,strDate
strYear=txtYear.value
strMonth=window.sltMonth.value
iWeekDate = (new Date(strYear,strMonth-1,1)).getDay();
iHowManyDays=HowManyDays(strMonth,strYear);
strDate=WhichDaySelected();
WriteNullToCalendar();
ResetbgColor();
setDaysToCalendar(iWeekDate,iHowManyDays,strDate);
m_DateValue=FormateDate(strYear,strMonth,strDate)
m_Self.style.height=tblTotalCalendar.clientHeight+2;
if (m_DateTextBox != null)
m_DateTextBox.value = m_DateValue;
}
function tdOnclick()
{
var src = event.srcElement
if (src.tagName != "TD")return false;
var strYear,strMonth,strDate
if (src.innerText!="" && src.innerText!=" ")
{
ResetbgColor();
src.style.backgroundColor = "#8991c8";
//src.className="selectTD";
src.Active = true;
m_tdActive = src;
strYear=txtYear.value;
strMonth=window.sltMonth.value;
strDate=src.innerText;
m_DateValue=FormateDate(strYear,strMonth,strDate);
if (m_DateTextBox != null)
m_DateTextBox.value = m_DateValue;
}
}
function tdOndblclick()
{
var src = event.srcElement
if (src.tagName != "TD")return false;
if (src.innerText!="" && src.innerText!=" ")
{
hide();
if (m_ondblclick != null)
m_ondblclick(m_DateTextBox);
}
}
/************************************************************************
Property: DateValue
purpose:
return : readOnly return selected date
************************************************************************/
function public_get_DateValue()
{
return m_DateValue;
}
/************************************************************************
Method: Initialize(self)
purpose:
return :
************************************************************************/
function public_Initialize(self)
{
m_Self = self
m_MarkDiv = self.parentElement;
}
/************************************************************************
Method: LinkObj(txtObj,btnObj)
purpose:
parameters: txtObj object of text btnObj object of button
return : readOnly return selected date
************************************************************************/
function public_linkObj(txtObj,btnObj)
{
m_DateTextBox = txtObj;
m_DateBtn = btnObj;
m_DateBtn.onclick = show;
}
/************************************************************************
Method: ClearLink()
purpose:
parameters:
return :
************************************************************************/
function public_clearLink()
{
m_DateTextBox = null;
m_DateBtn.onclick = null;
m_DateBtn = null;
}
/************************************************************************
Property: disable
purpose:
parameters:
return : read / write true / false
************************************************************************/
function public_put_disable(bFlag)
{
m_disableFlag = bFlag;
hide();
return 0;
}
function public_get_disable()
{
return m_disableFlag;
}
/************************************************************************
Event: ondblclick
purpose:
parameters:
return :
************************************************************************/
function public_put_onDblClick(funP)
{
m_ondblclick = funP;
}
function show()
{
if (m_disableFlag == true)
return -1
if (m_Self.style.visibility == "visible")
{
hide();
return 0
}
m_MarkDiv.style.visibility = "visible";
m_MarkDiv.onclick = hide;
var offSrc = m_DateTextBox.offsetParent;;
var offX = m_DateTextBox.offsetLeft
var offY = m_DateTextBox.offsetTop
while(offSrc.tagName!="BODY")
{
offX = offX + offSrc.offsetLeft;
offY = offY + offSrc.offsetTop;
offSrc = offSrc.offsetParent;
}
m_Self.style.width=tblTotalCalendar.clientWidth + 2
//m_Self.style.width=191;
m_Self.style.height=tblTotalCalendar.clientHeight + 2
if (offX > m_Self.parentElement.clientWidth - tblTotalCalendar.clientWidth)
m_Self.style.left = m_Self.parentElement.clientWidth - tblTotalCalendar.clientWidth-2;
else
m_Self.style.left =offX;
if (offY > m_Self.parentElement.clientHeight - tblTotalCalendar.clientHeight)
m_Self.style.top =offY - tblTotalCalendar.clientHeight;
else
m_Self.style.top =offY + m_DateTextBox.clientHeight;
m_Self.style.visibility="visible";
return 0
}
function hide()
{
m_MarkDiv.style.visibility = "hidden";
m_Self.style.visibility = "hidden"
}
//-->
</script>Top
5 楼yezhutou(向天朱)回复于 2006-03-04 15:19:58 得分 0
txtDate.aspx是在和calendar.aspx的同级页面中调用的,txtDate.aspx的调用方式是:
<object id="txtIssueTime" data="../PublicAsp/TxtDate.aspx" name="txtIssueTime" style="HEIGHT: 22px; LEFT: 0px; TOP: 0px; WIDTH: 110px" tabindex="100" type="text/x-scriptlet" viewastext>
</OBJECT>
而calendar.aspx是include进去的:<!--#include file="../PublicAsp/Calendar.aspx"-->
txtDate.aspx的代码是:
<HTML>
<HEAD>
<title> <%=Application["Title"]%>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style> INPUT.txtClass { font-size: 8pt; font-family: Arial; height: 16; border-top:none; border-left:none; border-right:none; border-bottom:1px #000000 solid; background-color:"Gainsboro"; color:black; }
TD.broder{ border-top: solid 1 #000000; border-left: solid 1 #000000; border-right: solid 1 #ffffff; border-bottom: solid 1 #ffffff; background: #ffffff; font-size: 8pt; font-family: arial; width : 87; height : 16; }
DIV.OutSide{ border-top: solid 1 #808080; border-left: solid 1 #808080; border-right: solid 1 #c0c0c0; border-bottom: solid 1 #c0c0c0; font-size: 8pt; font-family: arial; width : 87; height : 16; }
IMG.inactive{ filter: gray; width: 21; height: 21; }
</style>
<script language="javascript">
<!--
var m_txtID = new Array(3)
var m_disableFlag = false;
var m_datevalue;
var m_onReady = null; //Event ;
m_txtID[0] = "txtDay";
m_txtID[1] = "txtYear";
m_txtID[2] = "txtMonth";
document.onselectstart = DisableSelectOnWindow;
document.ondragstart = Function("return false;");
function DisableSelectOnWindow()
{
var src = event.srcElement;
if (src.tagName == "INPUT" && src.readOnly != true)
{
return true;
}
return false;
}
function window.onload()
{
Form1.txtMonth.onkeypress = CheckNumber;
Form1.txtDay.onkeypress = CheckNumber;
Form1.txtYear.onkeypress = CheckNumber;
}
function window.onfocus()
{
if (document.activeElement.id != "txtDay")
{
Form1.txtDay.select();
Form1.txtDay.focus();
}
}
function txt_onblur(Element)
{
switch (Element.id)
{
case "txtMonth":
if (parseFloat(Form1.txtMonth.value)<1 || parseFloat(Form1.txtMonth.value)>12)
{
Form1.txtMonth.value = "";
Form1.txtMonth.select();
return false;
}
if (Form1.txtMonth.value.length<2&&Form1.txtMonth.value!="")
Form1.txtMonth.value = "0"+Form1.txtMonth.value;
if (Form1.txtYear.value != "" && Form1.txtDay.value != "")
{
if (isDate(getDate()))
{
if (m_onReady!=null)
m_onReady();
}
else
{
Form1.txtDay.value = "";
Form1.txtDay.select();
}
}
break;
case "txtDay":
if (parseFloat(Form1.txtDay.value)<1 || parseFloat(Form1.txtDay.value)>31)
{
Form1.txtDay.value = ""
Form1.txtDay.select();
return false;
}
if (Element.value.length<2&&Element.value!="")
Element.value = "0"+Element.value;
if (Form1.txtMonth.value != "" && Form1.txtYear.value != "")
{
if (isDate(getDate()))
{
if (m_onReady!=null)
m_onReady();
}
else
{
Form1.txtDay.value = "";
Form1.txtDay.select();
}
}
break;
case "txtYear":
if (Form1.txtMonth.value == "" && Form1.txtDay.value == "" && Form1.txtYear.value == "")
break;
if (parseFloat(Form1.txtYear.value)<1900)
{
Form1.txtYear.value = "";
Form1.txtYear.select();
return false;
}
if (Form1.txtMonth.value == "")
{
Form1.txtMonth.focus();
return;
}
if (Form1.txtDay.value == "")
{
Form1.txtDay.focus();
return;
}
if (Form1.txtYear.value != "")
{
if (isDate(getDate()))
{
if (m_onReady!=null)
m_onReady();
}
else
{
Form1.txtDay.value = "";
Form1.txtDay.select();
}
}
break;
}
return true;
}Top




