<!--
/*==================================/
*與樣式textBox綁定的行為檔案
*
*功能:
* 實現當使用者的游標定位在某輸入框時,
* 該輸入框顯示不同的顏色的動態效果
===================================*/
-->
<public:attach event="onfocus" onevent="doFocus()"/>
<public:attach event="onblur" onevent="doBlur()"/>
<script language="jscript">
function doFocus()
{
if(element.tagName != 'INPUT' && element.tagName != 'TEXTAREA')
return false;
if(element.tagName == 'INPUT' && (element.type == "submit" || element.type == "button" ))
return false;
if(!element.readOnly)
{
element.style.backgroundColor = '#E0FFFF';
}
}
function doBlur()
{
if(element.tagName != 'INPUT' && element.tagName != 'TEXTAREA')
return false;
if(element.tagName == 'INPUT' && (element.type == "submit" || element.type == "button" ))
return false;
element.style.backgroundColor = '#FFFFFF';
}
//取cookie的內容
function getCookieVal (offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
//擷取指定cookie的值
function getCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
</script>