Change (FN)
binds a handler function in the change event for each matching element. The
Change event is triggered when the element loses focus, and when its value is changed after the focus has been obtained.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; Charset=utf-8 "/> <title> pride </title> <script type=" Text/javascript "src=" http:// Ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js "></script> <style> p{line-height:23px; margin:0;padding:0;} </style> <script> $ (function () {$ (' #c-obj Select '). Change (function () {Alert ($ (this). attr (' id ') + ': ' + $ ( This). Val ()); $ (' P '). CSS ($ (this). attr (' ID '), $ (this). Val ()); The ID of the select and the CSS property value to be set must be consistent}); }); </script> </pead> <body> <p>change (FN) </p> <p> binds a handler function in each matching element's change event. The </p> <p>change event triggers when the element loses focus, and when its value is changed after the focus has been obtained. </p> <div id= "C-obj" > <label for= "font-size" > Font size </label> <select name= "id=" font-sIze "> <option value=" 12px "> Trumpet </option> <option value=" 14px "> Lesser </option> <option value= "16px" > Medium </option> <option value= "18px" > Large </option> <option value= "24px" > Large </option > </select> <label for= "background" > Background color </label> <select name= "" id= "Background" > <opti On value= "#F4FBFF" > Default </option> <option value= "Gray" > Grayish </option> <option value= "Red" > Red </option> <option value= "green" > Green </option> <option value= "Yellow" > Yellow </option> </ select> <label for= "color" > Font color </label> <select id= "Color" > <option value= "#000" > Black </ option> <option value= "#f00" > Red </option> <option value= "#060" > Green </option> <option Value= "#00f" > Blue </option> <option value= "#600" > Brown </option> </select> <label> </ Div> <p> Spring River Flower Night </p> <p> Spring River Tide even sea level, the sea bright Moon tide health。 Yan Yan with wave million, where Spring River no month Ming. </p> <p> the river Wanzhuan around the Fragrant meadow, the moon shines like the flower forest is the sleet. The frost in the air does not fly, and the white sands of the ting are invisible. </p> <p> jiang Tianyi color no dust, jiaojiao air solitary moon round. Who is the first month on the riverside? When did shine back again the first person? </p> <p> life generations have been endless, the river month is only similar year. Do not know Jiang month to whom, see the Yangtze River send water. </p> <p> white clouds go leisurely, green maple pu on the worry. Who's boat tonight? Where Acacia Moon building? </p> <p> The poor building lingered last month, and should be dresser from human makeup. Jade Household curtains in the roll not to go, ramming anvil on the whisk. </p> <p> at this time to look at each other, willing to monthly Hua Liu Zhao June. Hongyan long flying Light, fish Dragon dive water written. </p> <p> last night, the dream of the fallen flower, poor spring half not haigu. River water Spring to try to do, Jiang Tan fall month complex West oblique. </p> <p> Oblique month deep hidden sea fog, Jie Shi Xiaoxiang Unlimited road. I do not know how many people return to the moon, the Moon Shake Love full river tree. </p> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Jquery Change (fontsize,background) code that changes color and background