JavaScript ÑÕÉ«ÌݶȺͽ¥±äЧ¹û
ʵÀýЧ¹û
Ô¤ÀÀЧ¹û1£º
ÕâÊÇÒ»¸öÑÕÉ«Ìݶȱ仯ÑÝʾ£º
Ô¤ÀÀЧ¹û2£º
Ò»¸öÑÕÉ«½¥±äµÄ²Ëµ¥£º
Cropper
Tween
Slider
Resize
Drag
Ô¤ÀÀЧ¹û3£º
ÑÕÉ«½¥±äµÄÓÐȤӦÓ㬵ã»÷Ëæ»úÑÕÉ«½¥±ä£º
µã»÷Ëæ»ú»»ÑÕÉ«
³ÌÐò˵Ã÷
¡¾ColorGradsÑÕÉ«Ìݶȡ¿
³ÌÐòColorGradsµÄ×÷ÓÃÊÇͨ¹ýStartColorºÍEndColorÉú³ÉÑÕÉ«Ìݶȼ¯ºÏ¡£
ÑÕÉ«¶¼¿ÉÒÔÓúì(r)¡¢ÂÌ(g)¡¢À¶(b)Èý¸öÑÕÉ«À´±íʾ¡£
³ÌÐòÖÐÏÈͨ¹ýGetColor°ÑÒ»°ãµÄÑÕÉ«±íʾÐÎʽת»¯³ÉÒ»¸öÓúì(r)¡¢ÂÌ(g)¡¢À¶(b)Èý¸öÑÕÉ«Öµ×÷ÔªËصļ¯ºÏ¡£
ÄǾÍÊ×ÏÈÒªÖªµÀÓÐʲôÑÕÉ«±íʾÐÎʽ£¬´Ów3cµÄColors²¿·Ö¿ÉÒÔÖªµÀÓÐÒÔÏÂÐÎʽ£º
¹Ø¼ü´Êģʽ£º
em { color: red }
RGBÑÕɫģʽ£º
em { color: #f00 }
em { color: #ff0000 }
em { color: rgb(255,0,0) }
em { color: rgb(100%, 0%, 0%) }
ÒÔÉ϶¼ÊDZíʾͬһÖÖÑÕÉ«£¨ºìÉ«£©¡£
»ñÈ¡ÑÕÉ«ÊôÐÔµÄÐÎʽÔÚieºÍff²¢²»Í¬£¬ffͳһ·µ»ØRGBÑÕɫģʽµÄµÚÈýÖÖÐÎʽ£¬ieÔò°´ÕÕÉèÖÃʱµÄÐÎʽ·µ»Ø¡£
ÏÈ˵˵RGBÑÕɫģʽ£¬Ç°Á½ÖֱȽϳ£ÓÃÓ¦¸Ã¶¼Ã÷°×ËûÃǵÄÇø±ð°É£¬ËüÓõÄÊÇ16½øÖƱíʾÐÎʽ£¬¶øÎÒÃÇÏëÒª10½øÖƵġ£
°ÑÒ»¸ö16½øÖƱíʾµÄ×Ö·ûת³É10½øÖÆÊý×Ö£¬Ò»°ãÓÃparseInt£¬ÔÚsubstr½ØÈ¡×Ö·ûÖ®ºó¾Í¿ÉÒÔÓÃparseIntת»»¡£
¶ÔÓÚ#ff0000Õâ¸öÐÎʽ¿ÉÒÔÕâÑùת»»£º
return Map([color.substr(1, 2), color.substr(3, 2), color.substr(5, 2)],
function(x){ return parseInt(x, 16); }
)
parseIntµÄµÚ¶þ¸ö²ÎÊý¾ÍÊǵÚÒ»¸ö²ÎÊýµÄ½øÖÆÖµ¡£
¶ÔÓÚ#f00ÐÎʽ£¬¸úÉÏÒ»¸ö²î²»¶à£¬Ö»ÊÇת»»Ö®Ç°ÒªÏÈ»»³ÉÍêÕû±íʾÐÎʽ£º
return Map([color.substr(1, 1), color.substr(2, 1), color.substr(3, 1)],
function(x){ return parseInt(x + x, 16); }
)
ºóÃæÁ½ÖÖ¿ÉÄÜÓõľͱȽÏÉÙÁË£¬Ò»¸öÓÃ10½øÖƵÄrgbÑÕÉ«Öµ±íʾ£¬ÁíÒ»¸öÓðٷֱÈÀ´±íʾ¡£
ffÑϸñ°´ÕÕÄÇÑùµÄ¸ñʽÀ´±íʾ£¬¶øie¾Í“·ÅËÉ”ºÜ¶à£¬ÀýÈ磺
ie¿ÉÒÔÔÊÐíÊý×ְٷֱȻìÓã¬ff²»¿ÉÒÔ£»
ff±ØÐëÓжººÅ·Ö¸ô£¬ie¿ÉÒÔÖ»Óÿոñ·Ö¸ô£»
µ±È»ÎÒÃÇʹÓÃʱ×îºÃÊÇ°´ÕÕw3cµÄ±ê×¼À´ÉèÖÃÁË¡£
ps£ºÄǸöDHTML ÊÖ²áÉÏдµÄ EM { color: rgb 1.0 0.0 0.0 } ¸ù±¾²»ÄÜÓõģ¬²»Òª±»Îóµ¼ÁË¡£
¶ÔÕâ¸öÐÎʽ£¬³ÌÐòÓÃÕýÔòÈ¡µÃÊýÖµ£¬Èç¹ûÓÐ%¾Í¸ù¾Ý°Ù·Ö±È¼ÆËã³ö¶ÔÓ¦ÊýÖ
Ïà¹ØÎĵµ£º
1. CSS
<style>
.dstyle1 {
font-size:13px;
font-weight: bold;
color: #ff6600;
}
.dstyle2 {
font-size:13px;
font-weight: bold;
color: #ffffff;
}
</style>
2. JavaScript
<script type="text/javascript">
m();
function m()
{
document.getElementById("span_new").classNa ......
ÔÚjsÖУ¬Ã¿¸ö¶ÔÏó¶¼ÓÐÒ»¸öprototypeÊôÐÔ£º·µ»Ø¶ÔÏóÀàÐÍÔÐ͵ÄÒýÓ᣺ÜÞÖ¿Ú£¡Ï°Óï“ÒÀºù«»Æ°”£¬ÕâÀïµÄºù«¾ÍÊÇÔÐÍ£¬ÄÇô“Æ°.prototype” ·µ»ØµÄ¾ÍÊǺù«£¬»òÕß“Æ°.prototype= new ºù«()”¡£
prototypeµÄÓÃ;£º
¼Ì³Ð
ÓÐÒ»¸ö¶ÔÏó££×ÓÀࣺ
function ×ÓÀà() {
this.lastname = ......
¶¨ÒåÓëÓ÷¨
The prototype property allows you to add properties and methods to an
object.
prototypeÊôÐÔÔÊÐíÄãÏòÒ»¸ö¶ÔÏóÌí¼ÓÊôÐԺͷ½·¨
Syntax
Óï·¨
object.prototype.name=value
Example 1
ʵÀý
In this example we will show how to use the prototype property to add a
property to an object:
ÔÚÏÂ ......
ÎļþÄÚÈÝÈçÏ£º£¨Á½¸öÎļþglossy.jsºÍglossy.html£©
/********************************** glossy.js ***********************************/
/**
* glossy.js 1.31 (19-Jul-2007)
* (c) by Christian Effenberger
* All Rights Reserved
* Source: glossy.netzgesta.de
* Distrib ......
¶þ¡¢¶¯Ì¬¸ø±í²åÈëÐУº
function addRow(){
//¶¯Ì¬²åÈëÒ»ÐÐ
var oRow1=mediaMes.insertRow(mediaMes.rows.length);
//ÉèÖÃtrµÄid
oRow1.id="tr"+thisId;
//»ñµÃ±í×ܵÄÐÐÊý
var aRows=mediaMes.rows;
//»ñµÃÐÂÌí¼ÓÐеÄÁм¯ºÏ
var aCells=oRow1. ......