仿googleadsense颜色选择器代码
css代码
复制代码 代码如下:
<styletype="text/css">
BODY{
PADDING-RIGHT:0px;PADDING-LEFT:0px;FONT-WEIGHT:normal;FONT-SIZE:12px;PADDING-BOTTOM:0px;MARGIN:0px;COLOR:#02418a;PADDING-TOP:0px;FONT-FAMILY:Arial
}
FORM{
MARGIN:0px
}
INPUT{
MARGIN:0px
}
TABLE{
FONT-WEIGHT:normal;FONT-SIZE:12px;LINE-HEIGHT:170%;FONT-FAMILY:Arial
}
A:link{
COLOR:#02418a;TEXT-DECORATION:none
}
A:visited{
COLOR:#02418a;TEXT-DECORATION:none
}
A:hover{
COLOR:#ff0000;TEXT-DECORATION:none
}
.colorhover{
BORDER-RIGHT:blue1pxsolid;BORDER-TOP:blue1pxsolid;DISPLAY:block;MARGIN-LEFT:4px;BORDER-LEFT:blue1pxsolid;WIDTH:20px;CURSOR:pointer;BORDER-BOTTOM:blue1pxsolid;HEIGHT:16px
}
TABLE.palette{
BORDER-RIGHT:#9999991pxsolid;BORDER-TOP:#9999991pxsolid;FONT-SIZE:5px;BACKGROUND:#000000;BORDER-LEFT:#9999991pxsolid;BORDER-BOTTOM:#9999991pxsolid;BORDER-COLLAPSE:collapse
}
TABLE.paletteTDA{
DISPLAY:block;TEXT-DECORATION:none
}
TABLE.paletteTDADIV{
WIDTH:20px;HEIGHT:20px
}
TABLE.paletteA{
BORDER-RIGHT:#cccccc1pxsolid;PADDING-RIGHT:1px;BORDER-TOP:#cccccc1pxsolid;PADDING-LEFT:1px;PADDING-BOTTOM:1px;BORDER-LEFT:#cccccc1pxsolid;PADDING-TOP:1px;BORDER-BOTTOM:#cccccc1pxsolid
}
TABLE.paletteA:hover{
BORDER-RIGHT:red1pxsolid;BORDER-TOP:red1pxsolid;BORDER-LEFT:red1pxsolid;CURSOR:pointer;BORDER-BOTTOM:red1pxsolid
}
</style>
仿googleadsense颜色选择器代码用到的核心javascript代码
复制代码 代码如下:
<scripttype="text/javascript">
//中易广告联盟程序Bywww.zyiis.comQQ:381611116
functionshowPicker(colorField,atElement){
varpicker=document.getElementById("color_picker");
varelement=(atElement!=undefined)
?atElement
:document.getElementById("zyad_style_color_"+colorField);
//alert(getTopOffset(document.all.zyad_style_color_border));
pickerField=colorField;
picker.style.top=getTopOffset(element);
picker.style.left=getLeftOffset(element)+90;
picker.style.display='block';
document.onmouseup=hidePicker;
}
functionhidePicker(){
varpicker=document.getElementById("color_picker");
pickerField=null;
picker.style.display='none';
clicked=false;
}
functiongetTopOffset(element){
return(element==document.body)
?0
:(element.offsetTop+getTopOffset(element.offsetParent));
}
functiongetLeftOffset(element){
return(element==document.body)
?0
:(element.offsetLeft+getLeftOffset(element.offsetParent));
}
functionselectColor(colorValue){
elem("colorsample-"+pickerField).style.backgroundColor='#'+colorValue;
if(external){
elem("zyad_style_color_"+pickerField).value=colorValue;
}
if(pickerField=='background')elem("zyad_style_bg").style.backgroundColor='#'+colorValue;
if(pickerField=='border'){
elem("zyad_style_bg").style.border="1pxsolid#"+colorValue;
elem("zyad_style_copy").style.backgroundColor='#'+colorValue;
elem("zyad_style_copy").style.color='#'+getTextHex(colorValue);
}
if(pickerField=='sitename')
{
elem("zyad_style_site_name").style.color='#'+colorValue;
elem("zyad_style_site_name1").style.color='#'+colorValue;
}
if(pickerField=='intro')
{
elem("zyad_style_site_intro").style.color='#'+colorValue;
elem("zyad_style_site_intro1").style.color='#'+colorValue;
}
if(pickerField=='siteurl')
{
elem("zyad_style_site_siteurl").style.color='#'+colorValue;
elem("zyad_style_site_siteurl1").style.color='#'+colorValue;
}
pickerField=null;
hidePicker();
getcode();
}
functionelem(element)
{
returndocument.getElementById(element);
}
functiontoColor(h){
return[parseInt(h.substring(0,2),16),
parseInt(h.substring(2,4),16),
parseInt(h.substring(4,6),16)];
}
functiongetTextHex(c){
if(c=="FFFFFF")
{
return"000";
}
else
{
return"FFFFFF";
}
}
functionget_trans_codes()
{
getcode()
}
functioncopymetasearch(sel_obj){
highlightmetasearch(sel_obj);
textRange=sel_obj.createTextRange();
textRange.execCommand("RemoveFormat");
textRange.execCommand("Copy");
}
functionhighlightmetasearch(sel_obj){
sel_obj.select();
sel_obj.focus();
}
/////
functionget_Option_Value(Options){
if(Options&&Options.length){
for(vari=0;i<Options.length;i++){
if(Options[i].selected){
returnOptions[i].value;
}
}
}else{
return;
}
}
functionget_radio_value(field){
if(field&&field.length){
for(vari=0;i<field.length;i++){
if(field[i].checked){
returnfield[i].value;
}
}
}else{
return;
}
}
functionget_checkbox_value(field){
if(field.checked){
returnfield.value;
}
return"";
}
functionget_style_codes(){
style=elem("get_style").value;
varp=style.split(',');
zyad_style_color_border=p[0];
zyad_style_color_sitename=p[1];
zyad_style_color_background=p[2];
zyad_style_color_intro=p[3];
zyad_style_color_siteurl=p[4];
varzyad_style_copy_d=get_radio_value(form_zyad_codes.ad_iframe);
elem("zyad_style_color_border").value=zyad_style_color_border;
elem("zyad_style_color_sitename").value=zyad_style_color_sitename;
elem("zyad_style_color_background").value=zyad_style_color_background;
elem("zyad_style_color_intro").value=zyad_style_color_intro;
elem("zyad_style_color_siteurl").value=zyad_style_color_siteurl;
if(zyad_style_copy_d==1){
elem("zyad_style_bg").style.border="1pxsolid#"+zyad_style_color_border;
}
else
{
elem("zyad_style_bg").style.border="0pxsolid#ffffff";
}
elem("zyad_style_copy").style.backgroundColor='#'+zyad_style_color_border;
elem("zyad_style_copy").style.color='#'+getTextHex(zyad_style_color_border);
elem("zyad_style_site_name1").style.color='#'+zyad_style_color_sitename;
elem("zyad_style_site_name").style.color='#'+zyad_style_color_sitename;
elem("colorsample-border").style.backgroundColor=zyad_style_color_border;
elem("colorsample-sitename").style.backgroundColor=zyad_style_color_sitename;
elem("colorsample-background").style.backgroundColor=zyad_style_color_background;
elem("colorsample-intro").style.backgroundColor=zyad_style_color_intro;
elem("colorsample-siteurl").style.backgroundColor=zyad_style_color_siteurl;
getcode();
}
</script>
当前1/2页12下一页阅读全文