给MSCRM表单增加按钮(JS)

 

var new_button =document.createElement('button');
new_button.setAttribute('id','new_button');
new_button.setAttribute('value','审核通过');

new_button.DataValue = "Ok";
new_button.visible = true;
new_button.style.textAlign = "center";
new_button.vAlign = "middle";

new_button.style.cursor = "hand";
new_button.style.backgroundColor = "#CADFFC";
new_button.style.color = "#FF0000";
new_button.style.borderColor = "#330066";
new_button.style.fontWeight = "bold";
new_button.contentEditable = false;

new_button.attachEvent("onmousedown",color1);
new_button.attachEvent("onmouseup",color2);
new_button.attachEvent("onmouseover",color3);
new_button.attachEvent("onmouseleave",color4);
function color3() {
new_button.style.backgroundColor = "#6699FF";
}
function color4() {
new_button.style.backgroundColor = "CADFFC";
}
function color1() {
new_button.style.color = "000099";
}
function color2() {
new_button.style.color = "FF0000";
}

new_button.attachEvent("onclick",someFunction);

function someFunction(){
alert(1);
}
document.forms[1].appendChild(new_button);

posted @ 2009-03-25 10:49  wendy-丽  阅读(194)  评论(0编辑  收藏  举报