最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

css樣式之區(qū)分input是按鈕還是文本框的方法第3/4頁

 更新時間:2008年09月02日 00:26:12   作者:  
對設(shè)置樣式時怎么區(qū)分input是按鈕還是文本框問題的技術(shù)調(diào)查——把input里面的東西剔出來

3:用javascript腳本實現(xiàn)
實現(xiàn)參考代碼:
前臺html代碼:
<!doctype html public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    
<title> diffInput </title>
    
<meta name="Author" content="JustinYoung">
    
<meta name="Keywords" content="">
    
<meta name="Description" content="">
    
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
    
<style type="text/css">
    input
{behavior:url('css.htc');}
    
</style>
</head>

<body>
<dl>
<dt>This is normal textbox:<dd><input type="text" name="">
<dt>This is password textbox:<dd><input type="password" name="">
<dt>This is submit button:<dd><input type="submit">
<dt>This is reset button:<dd><input type="reset">
<dt>This is radio:<dd><input type="radio" name="ground1"> <input type="radio" name="ground1">
<dt>This is checkbox:<dd><input type="checkbox" name="ground2"> <input type="checkbox" name="ground2">
<dt>This is normal button:<dd><input type="button" value="i'm button">
</dl>
</body>
</html>

Css.htc代碼:
<script language=javascript>
switch(type)
{
    
case 'text':
    style.backgroundColor
="red";
    
break;

    
case 'password': 
    style.backgroundImage
="url(BG.gif)";
    
break;

    
case 'submit':
    style.backgroundColor
="blue";
    style.color
="white";
    
break;

    
case 'reset':
    style.backgroundColor
="navy";
    style.color
="white";
    
break;

    
case 'radio': 
    style.backgroundColor
="hotpink";
    
break;

    
case 'checkbox': 
    style.backgroundColor
="green";
    
break;

    
case 'button':
    style.backgroundColor
="lightblue";
    
break;

    
default: ;//others use default style.
}
</script>

優(yōu)點:可以分區(qū)出各個input控件形態(tài)。多種技術(shù)的混合使用,滿足“我是高手”的虛榮心。
缺點:技術(shù)牽扯面教廣,因為用js后期處理,所以在js沒有起作用之前,各個input還是原始狀態(tài),然后突然“變帥”會讓你的頁面很奇怪。較致命的是FireFox不支持 Orz…

相關(guān)文章

最新評論

满洲里市| 社旗县| 南澳县| 柳江县| 兴山县| 宜川县| 饶平县| 巫山县| 西乌珠穆沁旗| 南充市| 赣榆县| 讷河市| 大埔县| 同心县| 廊坊市| 新巴尔虎右旗| 微博| 保德县| 信阳市| 望江县| 仪陇县| 垫江县| 扶余县| 炎陵县| 泽库县| 石柱| 三明市| 永清县| 辽源市| 麟游县| 新晃| 射洪县| 招远市| 神农架林区| 金阳县| 阜平县| 修水县| 南雄市| 如皋市| 长宁区| 郯城县|