Imitation google AdSense color selector code, from the Easy AD League program extraction [original] 1th 2 page _javascript tips

Source: Internet
Author: User
Imitation google AdSense color selector code
CSS Code
Copy Code code as follows:

<style type= "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:blue 1px solid; Border-top:blue 1px solid; Display:block; margin-left:4px; Border-left:blue 1px solid; width:20px; Cursor:pointer; Border-bottom:blue 1px solid; Height:16px
}
Table.palette {
Border-right: #999999 1px solid; Border-top: #999999 1px solid; font-size:5px; BACKGROUND: #000000; Border-left: #999999 1px solid; Border-bottom: #999999 1px solid; Border-collapse:collapse
}
Table.palette TD A {
Display:block; Text-decoration:none
}
Table.palette TD A DIV {
width:20px; height:20px
}
Table.palette A {
Border-right: #cccccc 1px solid; padding-right:1px; Border-top: #cccccc 1px solid; padding-left:1px; padding-bottom:1px; Border-left: #cccccc 1px solid; padding-top:1px; Border-bottom: #cccccc 1px solid
}
Table.palette A:hover {
border-right:red 1px solid; border-top:red 1px solid; border-left:red 1px solid; Cursor:pointer; border-bottom:red 1px solid
}
</style>

The core JavaScript code used in imitation of Google AdSense color selector code
Copy Code code as follows:

<script type= "Text/javascript" >
China-Easy Advertising Alliance program by Www.zyiis.com qq:381611116
function Showpicker (colorfield,atelement) {

var Picker=document.getelementbyid ("Color_picker");

var element= (atelement!=undefined)
? atelement
:d Ocument.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;

}

function Hidepicker () {


var Picker=document.getelementbyid ("Color_picker");
Pickerfield=null;
Picker.style.display= ' None ';
Clicked=false;

}
function Gettopoffset (Element) {

Return (Element==document.body)
? 0
:(Element.offsettop+gettopoffset (element.offsetparent));

}
function Getleftoffset (Element) {

Return (Element==document.body)
? 0
:(Element.offsetleft+getleftoffset (element.offsetparent));

}

function Selectcolor (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= "1px solid #" +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 ();

}
function Elem (Element)
{

return document.getElementById (Element);

}

function Tocolor (h) {

return [parseint (H.substring (0,2), 16),
parseint (h.substring (2,4), 16),
parseint (H.substring (4,6), 16)];

}

function Gettexthex (c) {


if (c== "FFFFFF")
{

Return "000";

}
Else
{

return "FFFFFF";

}


}


function Get_trans_codes ()
{

GetCode ()

}

function Copymetasearch (sel_obj) {

Highlightmetasearch (Sel_obj);
Textrange=sel_obj.createtextrange ();
Textrange.execcommand ("Removeformat");
Textrange.execcommand ("Copy");

}
function Highlightmetasearch (sel_obj) {

Sel_obj.select ();
Sel_obj.focus ();

}

/////

function Get_option_value (Options) {

if (options&&options.length) {

for (Var i=0;i<options.length;i++) {

if (options[i].selected) {

return options[i].value;

}

}

}else {

return;


}

}
function Get_radio_value (field) {

if (field&&field.length) {

for (Var i=0;i<field.length;i++) {

if (field[i].checked) {

return field[i].value;

}

}

}else {

return;


}

}

function Get_checkbox_value (field) {

if (field.checked) {

return field.value;

}
Return "";

}

function Get_style_codes () {

Style=elem ("Get_style"). Value;
var p=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];
var zyad_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= "1px solid #" +zyad_style_color_border;

}
Else
{
Elem ("Zyad_style_bg"). style.border= "0px solid #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>

Current 1/2 page 12 Next read the full text

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.