⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frame.htc

📁 Windows Web脚本开发指南/(美) Dan Heflin, Todd Ney著 的源码
💻 HTC
字号:
</SCRIPT>
<PUBLIC: COMPONENT URN="frame">
<PUBLIC:PROPERTY NAME="caption" GET="getcaption" PUT="putcaption"/>
<PUBLIC:PROPERTY NAME="borderwidth" GET="getborderwidth" PUT="putborderwidth"/>
<PUBLIC:PROPERTY NAME="borderstyle" GET="getborderstyle" PUT="putborderstyle"/>
<PUBLIC:PROPERTY NAME="bordercolor" GET="getbordercolor" PUT="putbordercolor"/>
<PUBLIC:PROPERTY NAME="height" GET="getheight"/>
<PUBLIC:PROPERTY NAME="width" GET="getwidth" />
<PUBLIC:PROPERTY NAME="top" GET="gettop" PUT="puttop"/>
<PUBLIC:PROPERTY NAME="left" GET="getleft" PUT="putleft"/>
<PUBLIC:PROPERTY NAME="margin" GET="getmargin" PUT="putmargin"/>
<PUBLIC:PROPERTY NAME="color" GET="getcolor" PUT="putcolor"/>
<PUBLIC:PROPERTY NAME="font" GET="getfont" PUT="putfont"/>
<PUBLIC:PROPERTY NAME="backgroundimage" GET="getbgimg" PUT="putbgimg"/>
<PUBLIC:PROPERTY NAME="backgroundcolor" GET="getbgcolor" PUT="putbgcolor"/>
<PUBLIC:METHOD Name="appendElement" />
<PUBLIC:METHOD Name="removeElement" />
<PUBLIC:EVENT Name=onappendElement id=evtOnAppendElement />
<PUBLIC:EVENT Name=onremoveElement id=evtOnRemoveElement />
<PUBLIC:ATTACH EVENT="ondocumentready" for="element" ONEVENT="ShowDocument()" />


<script language="JavaScript">
var vcaption = null;
var vborderwidth = null;
var vborderstyle = null;
var vbordercolor = null;
var vheight = null;
var vwidth = null;
var vtop = null;
var vleft = null;
var vmargin = null;
var vcolor = null;
var vfont = null;
var vbackgroundimage = null;
var vbackgroundcolor = null;

function putcaption(text)
{
var s, s1;
var re;

	s = text;
	re = / /g;
	s1 = s.replace(re, "&nbsp;");
	if (vcaption != null)
		eval(element.id + "pbsLabel").innerHTML = s1;	
	vcaption = s1;
}

function getcaption()
{
	return vcaption;
}

function putborderwidth(width)
{
	if (isNaN(parseInt(width, 10)))
		alert('The border width value is not numeric - ' + width);
	else
		if (vborderwidth != null)
			eval(element.id + "pbsFrame").style.borderWidth = width;	
		vborderwidth = width;
}

function getborderwidth()
{
	return eval(element.id + "pbsFrame").style.borderWidth;
}

function putborderstyle(style)
{
	if (style != 'inset' && style != 'outset' && style != 'none' 
	    && style != 'dotted' && style != 'dashed' && style != 'solid'
	    && style != 'double' && style != 'groove' && style != 'ridge') 
		alert('The border style value is not valid - ' + style);
	else{
		if (vborderstyle != null)	
			eval(element.id + "pbsFrame").style.borderStyle = style;	
		vborderstyle = style;
	}
}	

function getborderstyle()
{
	return eval(element.id + "pbsFrame").style.borderStyle;
}

function putbordercolor(color)
{
	if (color == '' || color == 'null' || color == null)
		alert('A border color was not assigned.');
	else{
		if (vbordercolor != null)
			eval(element.id + "pbsFrame").style.borderColor = color;	
		vbordercolor = color;
	}
}

function getbordercolor()
{
	return eval(element.id + "pbsFrame").style.borderColor;
}

function getheight()
{
	return (eval(element.id + "pbsLabel").getBoundingClientRect().bottom - eval(element.id + "pbsLabel").getBoundingClientRect().top);
}

function getwidth()
{
	return (eval(element.id + "pbsLabel").getBoundingClientRect().right - eval(element.id + "pbsLabel").getBoundingClientRect().left);
}

function puttop(top)
{
	if (isNaN(parseInt(top, 10)))
		alert('The frame top value is numeric - ' + top);
	else{
		if (vtop != null)
			eval(element.id + "pbsFrame").style.top = top;	
		vtop = top;
	}
}

function gettop()
{
	return eval(element.id + "pbsFrame").style.top;
}

function putleft(left)
{
	if (isNaN(parseInt(left, 10)))
		alert('The frame left value is numeric - ' + left);
	else{
		if (vleft != null)
			eval(element.id + "pbsFrame").style.left = left;	
		vleft = left;
	}
}

function getleft()
{
	return eval(element.id + "pbsFrame").style.left;
}

function putmargin(margin)
{
	if (isNaN(parseInt(margin, 10)))
		alert('The frame margin value is numeric - ' + margin);
	else{
		if (vmargin != null)
			eval(element.id + "pbsFrame").style.padding = margin;	
		vmargin = margin;
	}
}

function getmargin()
{
	return eval(element.id + "pbsFrame").style.padding;
}

function putcolor(color)
{
	if (vcolor != null)
		eval(element.id + "pbsLabel").style.color = color;	
	vcolor = color;
}

function getcolor()
{
	return eval(element.id + "pbsLabel").style.color;
}

function putbgcolor(bgcolor)
{
	if (vbackgroundcolor != null){
		eval(element.id + "pbsFrame").style.backgroundColor = bgcolor;	
		eval(element.id + "pbsLabel").style.backgroundColor = bgcolor;	
	}
	vbackgroundcolor = bgcolor;
}

function getbgcolor()
{
	return eval(element.id + "pbsLabel").style.backgroundColor;
}

function putbgimg(img)
{
	if (vbackgroundimage != null){
		eval(element.id + "pbsFrame").style.backgroundImage = 'url(' + img + ')';	
		eval(element.id + "pbsLabel").style.backgroundImage = 'url(' + img + ')';	
	}
	vbackgroundimage = img;

}

function getbgimg()
{
	return eval(element.id + "pbsLabel").style.backgroundImage;
}

function putfont(font)
{
	if (vfont != null)
		eval(element.id + "pbsLabel").style.fontFamily = font;	
	vfont = font;
}

function getfont()
{
	return eval(element.id + "pbsLabel").style.fontFamily;
}

function ShowDocument()
{
var eFrame;
var eLabel;
	
	eFrame = document.createElement("<div id='" + element.id + "pbsFrame' ></div>");
	eFrame.style.position = 'relative';
	eFrame.style.borderWidth = 3;
	eFrame.style.borderStyle = 'outset';
	eFrame.style.margin = 8;
	eFrame.style.width = '100%';
	eFrame.style.backgroundColor = 'white'
	if (vcaption == null)
		vcaption = '';
	if (vmargin != null)
		eFrame.style.padding = vmargin;
	else
		vmargin = '';
	if (vborderwidth != null)
		eFrame.style.borderWidth = vborderwidth;
	else
		vborderwidth = '';
	if (vborderstyle != null)
		eFrame.style.borderStyle = vborderstyle;
	else
		vborderstyle = '';
	if (vbordercolor != null)
		eFrame.style.borderColor = vbordercolor;
	else
		vborderwidth = '';
	if (vtop != null)
		eFrame.style.top = vtop;
	else
		vtop = '';
	if (vleft != null)
		eFrame.style.left = vleft;
	else
		vleft = '';
	if (vbackgroundimage != null)
		eFrame.style.backgroundImage = 'url(' + vbackgroundimage + ')';
	if (vbackgroundcolor != null)
		eFrame.style.backgroundColor = vbackgroundcolor;
	eFrame.innerHTML = element.innerHTML;
	element.innerHTML = '';
	element.insertBefore(eFrame, null);

	eLabel = document.createElement("<div id='" + element.id + "pbsLabel' style='border-style:none;border-width:1'></div>");
	eLabel.style.position = 'absolute';
	eLabel.style.top = -12;
	eLabel.style.height = 20;
	eLabel.style.left = 7;
	eLabel.style.zIndex = 1;
	if (vcolor != null)
		eLabel.style.color = vcolor;
	else
		vcolor = '';
	if (vfont != null)
		eLabel.style.fontFamily = vfont;
	else
		vfont = '';
	if (vbackgroundimage != null)
		eLabel.style.backgroundImage = 'url(' + vbackgroundimage + ')';
	else
		vbackgroundimage = '';
	if (vbackgroundcolor != null)
		eLabel.style.backgroundColor = vbackgroundcolor;
	else
		vbackgroundcolor = '';
	eLabel.innerHTML = '<span id="txtLabel">' + vcaption + '</span>'
	eLabel.style.backgroundColor = eFrame.style.backgroundColor;
	eFrame.insertBefore(eLabel, null);

}
function appendElement(objEle){
var objEvent;

 	eval(element.id + "pbsFrame").appendChild(objEle);
 	objEvent = createEventObject();
	objEvent.result = true;
	objEvent.element = objEle;
	evtOnAppendElement.fire(objEvent);
}
function removeElement(strEleID){
var objEvent;
var objNode;

 	objEvent = createEventObject();
	objEvent.result = true;
	objEvent.element = eval(element.id + "pbsFrame").children(strEleID);
	evtOnRemoveElement.fire(objEvent);
	if (objEvent.result){
	
		objNode = eval(element.id + "pbsFrame").children(strEleID);
		if (objNode != null){
				try{
	 				eval(element.id + "pbsFrame").removeChild(objNode);
	 			}
	 			catch(error){
	 				alert("Element with ID " + strEleID + " could not deleted because there is more than 1 element with that ID.");
	 			}
	 	}
	}
}
</script>
</PUBLIC: COMPONENT>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -