CSS 完全置中的寫法 取得連結 Facebook X Pinterest 以電子郵件傳送 其他應用程式 7月 26, 2016 CSS 完全置中的寫法 position: fixed; z-index: 2000; background: rgba(0, 0, 0, 0.7); display: block; top: 0px; left: 0px; bottom: 0px; overflow: auto; width: 100%; 取得連結 Facebook X Pinterest 以電子郵件傳送 其他應用程式 留言
jQuery獲取Select選擇的Text和Value(轉) 7月 19, 2016 jQuery獲取Select選擇的Text和Value(轉) jQuery獲取Select選擇的Text和Value: 語法解釋: 1. $("#select_id").change(function(){//code...}); //為Select添加事件,當選擇其中一項時觸發 2. var checkText=$("#select_id").find("option:selected").text(); //獲取Select選擇的Text 3. var checkValue=$("#select_id").val() ; //獲取Select選擇的Value 4. var checkIndex=$("#select_id ").get(0).selectedIndex; //獲取Select選擇的索引值 5. var maxIndex=$("#select_id option:last" ).attr("index"); //獲取Select最大的索引值 jQuery設置Select選擇的Text和Value: 語法解釋: 1. $("#select_id ").get(0).selectedIndex=1; //設置Select索引值為1的項選中 2. $("#select_id ").val(4); //設置Select的Value值為4的項選中 3. $("#select_id option[text='jQuery' ]").attr("selected", true); //設置Select的Text值為jQuery的項選中 jQuery添加/刪除Select的Option項: 語法解釋: 1. $("#select_id").append("<option value='Value'>Text</option>"); //為Select追加一個Option(下拉項) 2. $("#se... 閱讀完整內容
使用jQuery對 select 的操作(本文為網路找到的參考文) 6月 30, 2016 [jQuery] 使用 jQuery 對 select 的操作 1. 取得選擇項目的文字與值 /*----- 單選 -----*/ // 取得被選擇項目的文字 $ ( "#select" ). find ( ":selected" ). text (); // 取得被選擇項目的值 $ ( "#select" ). find ( ":selected" ). val (); /*----- 多選 -----*/ // 使用迴圈取得所有被選擇的項目 $ ( "#select" ). find ( ":selected" ). each ( function () { alert ( this . text ); // 文字 alert ( this .value); // 值 }); 2. 增加項目 $ ( "#select" ). append ( $ ( "<option></option>" ). attr ( "value" , " 值 " ). text ( " 文字 " )); 3. 移除選擇的項目 // 移除選擇的項目 $ ( "#select" ). find ( ":selected" ). remove (); // 移除全部的項目 $ ( "#select option " ). remove (); 4. 移除選擇項目後,防止捲軸移到最上面 // 先取得要移除項目的 index var selectIndex = $ ( "#select" ). find ( ":selected" ). index (); // 移除選擇的項目 $ ( "#select" ). find ( ":selected" ). remove (); // 判斷移除項目後,原先的 inde... 閱讀完整內容
Android 取消Button自帶陰影 (Style已經被用掉的狀況下仍然可用) 5月 10, 2017 因為設計上的需求,在製作Android按鈕的時候,常常因為Button自帶的陰影效果而被要求修改 所以自然有了取消陰影的需求 大部分網路上都是這種做法 style= "?android:attr/borderlessButtonStyle" 但是因為有些Button是會進行客製化(邊框間距、圓角等),所以Style這個欄位會被用掉,因此上面的方法就沒辦法使用了,那麼可以使用這個方法 < style name= "Button_Join" parent= "@style/Widget.AppCompat.Button.Borderless" > < item name= "android:background" > @color/color_ff9234 </ item > < item name= "android:textColor" > @color/color_f6f6f6 </ item > </ style > 在Style 的名稱後面加上這一行 parent= "@style/Widget.AppCompat.Button.Borderless" 這樣就可以了 閱讀完整內容
留言
張貼留言