G
Guest
Hi,
I want to encapsulate code to change BUTTON elements on a webpage in one
place in an HTC file.
Here is the code in my HTC FIle:
<PUBLIC:COMPONENT>
<PUBLIC:ATTACH EVENT="onmouseup" ONEVENT="MouseUp()" />
<PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="MouseOver()" />
<PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="MouseOut()" />
<PUBLIC:ATTACH EVENT="onmousedown" ONEVENT="MouseDown()" />
<SCRIPT LANGUAGE="JScript">
function MouseOver()
{
runtimeStyle.padding = "1px 4px 4px 4px";
runtimeStyle.filter =
"progidXImageTransform.Microsoft.Gradient(GradientType=0,
StartColorStr=#bababa, EndColorStr=#ffffff)";
runtimeStyle.borderRightStyle = "solid";
runtimeStyle.borderRightWidth = "1px";
runtimeStyle.borderRightColor = "#7b9ebd";
runtimeStyle.borderTopStyle = "ridge";
runtimeStyle.borderTopWidth = "1px";
runtimeStyle.borderTopColor = "#7b9ebd";
runtimeStyle.borderLeftStyle = "ridge";
runtimeStyle.borderLeftWidth = "1px";
runtimeStyle.borderLeftColor = "#7b9ebd";
runtimeStyle.borderBottomStyle = "ridge";
runtimeStyle.borderBottomWidth = "1px";
runtimeStyle.borderBottomColor = "#7b9ebd";
}
function MouseOut()
{
runtimeStyle.padding = "1px 4px 4px 4px";
runtimeStyle.filter =
"progidXImageTransform.Microsoft.Gradient(GradientType=0,
StartColorStr=#bababa, EndColorStr=#ffffff)";
runtimeStyle.borderRightStyle = "solid";
runtimeStyle.borderRightWidth = "1px";
runtimeStyle.borderRightColor = "#7b9ebd";
runtimeStyle.borderTopStyle = "ridge";
runtimeStyle.borderTopWidth = "1px";
runtimeStyle.borderTopColor = "#7b9ebd";
runtimeStyle.borderLeftStyle = "ridge";
runtimeStyle.borderLeftWidth = "1px";
runtimeStyle.borderLeftColor = "#7b9ebd";
runtimeStyle.borderBottomStyle = "ridge";
runtimeStyle.borderBottomWidth = "1px";
runtimeStyle.borderBottomColor = "#7b9ebd";
}
function MouseDown()
{
runtimeStyle.padding = "0px 4px 4px 4px";
runtimeStyle.color = "black";
runtimeStyle.backgroundColor = "white";
runtimeStyle.borderRightStyle = "solid";
runtimeStyle.borderRightWidth = "1px";
runtimeStyle.borderRightColor = "#7b9ebd";
runtimeStyle.borderTopStyle = "ridge";
runtimeStyle.borderTopWidth = "1px";
runtimeStyle.borderTopColor = "#7b9ebd";
runtimeStyle.borderLeftStyle = "ridge";
runtimeStyle.borderLeftWidth = "1px";
runtimeStyle.borderLeftColor = "#7b9ebd";
runtimeStyle.borderBottomStyle = "ridge";
runtimeStyle.borderBottomWidth = "1px";
runtimeStyle.borderBottomColor = "#7b9ebd";
}
function MouseUp()
{
runtimeStyle.padding = "1px 4px 4px 4px";
runtimeStyle.filter =
"progidXImageTransform.Microsoft.Gradient(GradientType=0,
StartColorStr=#ffffff, EndColorStr=#bababa)";
runtimeStyle.color = "";
runtimeStyle.backgroundColor = "";
runtimeStyle.borderRightStyle = "solid";
runtimeStyle.borderRightWidth = "1px";
runtimeStyle.borderRightColor = "#7b9ebd";
runtimeStyle.borderTopStyle = "ridge";
runtimeStyle.borderTopWidth = "1px";
runtimeStyle.borderTopColor = "#7b9ebd";
runtimeStyle.borderLeftStyle = "ridge";
runtimeStyle.borderLeftWidth = "1px";
runtimeStyle.borderLeftColor = "#7b9ebd";
runtimeStyle.borderBottomStyle = "ridge";
runtimeStyle.borderBottomWidth = "1px";
runtimeStyle.borderBottomColor = "#7b9ebd";
window.alert('Up')
}
</SCRIPT>
</PUBLIC:COMPONENT>
and in my HTML File I just have this for testing:
<HTML>
<INPUT Type = "button" Style="behavior:url(SAFButton.htc);
padding: 1px 4px 4px 4px;
font-size: 10pt;
font-family: Verdana;
height: 22px;
filter: progidXImageTransform.Microsoft.Gradient(GradientType=0,
StartColorStr=#ffffff, EndColorStr=#bababa);
border-right: #7b9ebd 1px solid;
border-top: #7b9ebd 1px ridge;
border-left: #7b9ebd 1px ridge;
border-bottom: #7b9ebd 1px ridge;"
value="button">
</HTML>
Problem is, it seems the MouseOut event, and the mouseup events are not
being triggered.
Itried putting window.alert at the end of each handler and the mouseout
and mouseup events were never triggered.
But I can make these changes easily using inline event handling so why
can't it work in an htc file?
Any help or advice would be appreciated.
thanks, Philip
I want to encapsulate code to change BUTTON elements on a webpage in one
place in an HTC file.
Here is the code in my HTC FIle:
<PUBLIC:COMPONENT>
<PUBLIC:ATTACH EVENT="onmouseup" ONEVENT="MouseUp()" />
<PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="MouseOver()" />
<PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="MouseOut()" />
<PUBLIC:ATTACH EVENT="onmousedown" ONEVENT="MouseDown()" />
<SCRIPT LANGUAGE="JScript">
function MouseOver()
{
runtimeStyle.padding = "1px 4px 4px 4px";
runtimeStyle.filter =
"progidXImageTransform.Microsoft.Gradient(GradientType=0,
StartColorStr=#bababa, EndColorStr=#ffffff)";
runtimeStyle.borderRightStyle = "solid";
runtimeStyle.borderRightWidth = "1px";
runtimeStyle.borderRightColor = "#7b9ebd";
runtimeStyle.borderTopStyle = "ridge";
runtimeStyle.borderTopWidth = "1px";
runtimeStyle.borderTopColor = "#7b9ebd";
runtimeStyle.borderLeftStyle = "ridge";
runtimeStyle.borderLeftWidth = "1px";
runtimeStyle.borderLeftColor = "#7b9ebd";
runtimeStyle.borderBottomStyle = "ridge";
runtimeStyle.borderBottomWidth = "1px";
runtimeStyle.borderBottomColor = "#7b9ebd";
}
function MouseOut()
{
runtimeStyle.padding = "1px 4px 4px 4px";
runtimeStyle.filter =
"progidXImageTransform.Microsoft.Gradient(GradientType=0,
StartColorStr=#bababa, EndColorStr=#ffffff)";
runtimeStyle.borderRightStyle = "solid";
runtimeStyle.borderRightWidth = "1px";
runtimeStyle.borderRightColor = "#7b9ebd";
runtimeStyle.borderTopStyle = "ridge";
runtimeStyle.borderTopWidth = "1px";
runtimeStyle.borderTopColor = "#7b9ebd";
runtimeStyle.borderLeftStyle = "ridge";
runtimeStyle.borderLeftWidth = "1px";
runtimeStyle.borderLeftColor = "#7b9ebd";
runtimeStyle.borderBottomStyle = "ridge";
runtimeStyle.borderBottomWidth = "1px";
runtimeStyle.borderBottomColor = "#7b9ebd";
}
function MouseDown()
{
runtimeStyle.padding = "0px 4px 4px 4px";
runtimeStyle.color = "black";
runtimeStyle.backgroundColor = "white";
runtimeStyle.borderRightStyle = "solid";
runtimeStyle.borderRightWidth = "1px";
runtimeStyle.borderRightColor = "#7b9ebd";
runtimeStyle.borderTopStyle = "ridge";
runtimeStyle.borderTopWidth = "1px";
runtimeStyle.borderTopColor = "#7b9ebd";
runtimeStyle.borderLeftStyle = "ridge";
runtimeStyle.borderLeftWidth = "1px";
runtimeStyle.borderLeftColor = "#7b9ebd";
runtimeStyle.borderBottomStyle = "ridge";
runtimeStyle.borderBottomWidth = "1px";
runtimeStyle.borderBottomColor = "#7b9ebd";
}
function MouseUp()
{
runtimeStyle.padding = "1px 4px 4px 4px";
runtimeStyle.filter =
"progidXImageTransform.Microsoft.Gradient(GradientType=0,
StartColorStr=#ffffff, EndColorStr=#bababa)";
runtimeStyle.color = "";
runtimeStyle.backgroundColor = "";
runtimeStyle.borderRightStyle = "solid";
runtimeStyle.borderRightWidth = "1px";
runtimeStyle.borderRightColor = "#7b9ebd";
runtimeStyle.borderTopStyle = "ridge";
runtimeStyle.borderTopWidth = "1px";
runtimeStyle.borderTopColor = "#7b9ebd";
runtimeStyle.borderLeftStyle = "ridge";
runtimeStyle.borderLeftWidth = "1px";
runtimeStyle.borderLeftColor = "#7b9ebd";
runtimeStyle.borderBottomStyle = "ridge";
runtimeStyle.borderBottomWidth = "1px";
runtimeStyle.borderBottomColor = "#7b9ebd";
window.alert('Up')
}
</SCRIPT>
</PUBLIC:COMPONENT>
and in my HTML File I just have this for testing:
<HTML>
<INPUT Type = "button" Style="behavior:url(SAFButton.htc);
padding: 1px 4px 4px 4px;
font-size: 10pt;
font-family: Verdana;
height: 22px;
filter: progidXImageTransform.Microsoft.Gradient(GradientType=0,
StartColorStr=#ffffff, EndColorStr=#bababa);
border-right: #7b9ebd 1px solid;
border-top: #7b9ebd 1px ridge;
border-left: #7b9ebd 1px ridge;
border-bottom: #7b9ebd 1px ridge;"
value="button">
</HTML>
Problem is, it seems the MouseOut event, and the mouseup events are not
being triggered.
Itried putting window.alert at the end of each handler and the mouseout
and mouseup events were never triggered.
But I can make these changes easily using inline event handling so why
can't it work in an htc file?
Any help or advice would be appreciated.
thanks, Philip