(תÔØ)javascript²Ù×÷Select±ê¼ÇÖÐoptions¼¯ºÏ
[ 2007-8-6 17:03:00 | By: ibrahim ]
javascript²Ù×÷Select±ê¼ÇÖÐoptions¼¯ºÏ
ÏÈÀ´¿´¿´options¼¯ºÏµÄÕ⼸¸ö·½·¨£º
options.add(option)·½·¨Ïò¼¯ºÏÀïÌí¼ÓÒ»Ïîoption¶ÔÏó£»
options.remove(index)·½·¨ÒƳýoptions¼¯ºÏÖеÄÖ¸¶¨Ï
options(index)»òoptions.item(index)¿ÉÒÔͨ¹ýË÷Òý»ñÈ¡options¼¯ºÏµÄÖ¸¶¨Ï
javascript´úÂëÈçÏ£º
var selectTag = null; //select񈬀
var OPTONLENGTH = 10; //ÿ´ÎÌî³äoptionÊý
var colls = []; //¶Ôselect±ê¼ÇoptionsµÄÒýÓÃ
window.onload = function(){
selectTag = document.getElementById("SelectBox"); //»ñÈ¡select±ê¼Ç
colls = selectTag.options; //»ñÈ¡ÒýÓÃ
//initSelectBox(); //×Ô³õʼ»¯select.options
};
//ʹÓÃËæ»úÊýÌî³äselect.options
function initSelectBox(){
var random = 0 ;
var optionItem = null;
var item = null;
if(colls.length > 0 && isClearOption()){
clearOptions(colls);
}
for(var i=0;i<OPTONLENGTH;i++){
&nb
Ïà¹ØÎĵµ£º
1ÅжÏselectÑ¡ÏîÖÐ ÊÇ·ñ´æÔÚValue="paraValue"µÄItem
2ÏòselectÑ¡ÏîÖÐ ¼ÓÈëÒ»¸öItem
3´ÓselectÑ¡ÏîÖРɾ³ýÒ»¸öItem
4ɾ³ýselectÖÐÑ¡ÖеÄÏî
5ÐÞ¸ÄselectÑ¡ÏîÖÐ value="paraValue"µÄtextΪ"paraText"
6ÉèÖÃselectÖÐtext="paraText"µÄµ ......
FusionChart ¾Í²»ÓýéÉÜÁË°Ñ£¬Ò»¿îÖ§³Ö¶àÖÖÓïÑÔµÄͼ±íÉú³É¿Ø¼þ£¬Éú³ÉµÄͼ±í·á¸»£¬ÃÀ¹Û£¬ÇÒÓж¯Ì¬¸Ð£¬ÒòΪËüÉú´æµÄ¶«Î÷¾ÍÊÇÒ»¸öflash¡£Ò»Ï½éÉÜÒ»ÏÂËüµÄjavascript ʵÏÖ·½Ê½°Ñ¡£
·Ï»°ÉÙ˵£¬Ö±½ÓÉÏʵÀý
<HTML>¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡ <HEAD>¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡ <SCRIPT LANGUAGE="Javascri ......
Array×÷ΪJavaScriptµÄÒ»¸öÄÚÖöÔÏó£¬ÓÐ×ÅÇ¿´óµÄ¹¦ÄÜ£»Ïà¶ÔÓÚÆäËûÄÚÖöÔÏóÀ´Ëµ£¬ËûÓÐ×ÅÌØÊâµÄÓ÷¨£¬ÏÂÃæ¶Ô˵˵×Ô¼º¶ÔArrayµÄÓ÷¨µÄÒ»¸öС×ܽ᣺
1>ÓÃ;һ£ºÊý×é
Êý×é×î´ó´æ´¢Êý¾ÝΪËÄÊ®¶àÒÚ¸ö£¬Õâ¸ö¿Õ¼ä×ã¹»ÓÃÁË£¬ËùÒÔÊý×é¿ÉÒÔËæ±ãµÄÀ©ÈÝ¡£ÏÂÃæ¶Ô³£Óõ ......
µÚÒ»ÖÖ·½·¨£ºÊ¹ÓÃinsertRowÌí¼ÓÐУ¬Ê¹ÓÃinsertCellÌí¼Óµ¥Ôª¸ñ£¬ÔÙÓÃinnerHTMLÌî³äµ¥Ôª¸ñ¡£Ê¹ÓÃdeleteRowɾ³ýÐУ¬´úÂëÈçÏ£º
Javascript´úÂ룺
function addRow()
{
var root = document.getElementById("tbody")
var&nb ......
javascriptÖÐreplace()
ÔÚjavascriptÖУ¬StringµÄº¯Êýreplace()¼òֱ̫ÈÃÈËϲ°®ÁË¡£ËüÁé»î¶øÇ¿´óµÄ×Ö·ûÌæ»»´¦ÀíÄÜÁ¦£¬ÈÃÎÒ²»½ûÏëÏò´ó¼Ò½éÉÜËü¡£
¡¡¡¡replace()×î¼òµ¥µÄËãÊÇÄÜÁ¦¾ÍÊǼòµ¥µÄ×Ö·ûÌæ»»¡£Ê¾Àý´úÂëÈçÏ£º
<script language="javascript">
var strM = "javascript is a good script ......