selected

What values can appear in the “selected” attribute of the “option” tag?

廉价感情. 提交于 2019-11-26 17:43:05
I have some markup similar to the following: <select> <option selected="selected">Apple</option> <option selected="">Orange</option> </select> In this case, "Orange" shows as the selected item. I would have expected making the selected attribute blank would undo its effects. Is there a way to write this without simply leaving the attribute out? Different browser may treat this attribute differently. According to the MSDN documentation (for Internet Explorer): To select an item in HTML, it is not necessary to set the value of the SELECTED attribute to true. The mere presence of the SELECTED

What is the difference between the states selected, checked and activated in Android?

喜欢而已 提交于 2019-11-26 17:29:30
问题 I'd like to know what differs those states. I didn't find any webpage clarifying this. 回答1: The difference between Checked and Activated is actually quite interesting. Even the Google documentation is apologetic (emphasis below added): ... For example, in a list view with single or multiple selection enabled, the views in the current selection set are activated. (Um, yeah, we are deeply sorry about the terminology here.) The activated state is propagated down to children of the view it is set

dropdownlist set selected value in MVC3 Razor

那年仲夏 提交于 2019-11-26 14:21:30
Here is my model: public class NewsCategoriesModel { public int NewsCategoriesID { get; set; } public string NewsCategoriesName { get; set; } } My controller: public ActionResult NewsEdit(int ID, dms_New dsn) { dsn = (from a in dc.dms_News where a.NewsID == ID select a).FirstOrDefault(); var categories = (from b in dc.dms_NewsCategories select b).ToList(); var selectedValue = dsn.NewsCategoriesID; SelectList ListCategories = new SelectList(categories, "NewsCategoriesID", "NewsCategoriesName",selectedValue); // ViewBag.NewsCategoriesID = new SelectList(categories as IEnumerable<dms_NewsCategory

Select an area to capture using the mouse

时光怂恿深爱的人放手 提交于 2019-11-26 13:55:05
问题 I'm making a Java based screen shot application, and I want to make it so when you push a combination of keys on your keyboard something like this video happens where you select and area on your screen, and it takes a screen shot of the selected area. How to select an area to capture using the mouse? 回答1: Start with something like this. import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.swing.*; /** Getting a Rectangle of interest on the screen. Requires the

how to get selected text from iframe with javascript?

大憨熊 提交于 2019-11-26 09:47:36
问题 <html> <body> <script type=\"text/javascript\"> function smth() { if (document.getSelection) { var str = document.getSelection(); if (window.RegExp) { var regstr = unescape(\"%20%20%20%20%20\"); var regexp = new RegExp(regstr, \"g\"); str = str.replace(regexp, \"\"); } } else if (document.selection && document.selection.createRange) { var range = document.selection.createRange(); var str = range.text; } alert(str); } </script> <iframe id=\"my\" width=\"300\" height=\"225\"> .....some html ...

UIButton: set image for selected-highlighted state

六眼飞鱼酱① 提交于 2019-11-26 08:46:11
问题 I set an images for button\'s states Normal,Highlighted and Selected, but when the button in selected state and I press/highlight it I didn\'t see my highlighted image but just grayed picture. Is it possible to set an image for highlighted state when the button selected? my code: [button setImage:[UIImage imageNamed:@\"normal.png\"] forState:UIControlStateNormal]; [button setImage:[UIImage imageNamed:@\"pressed.png\"] forState:UIControlStateHighlighted]; [button setImage:[UIImage imageNamed:@

Keeping a UIButton selected after a touch

巧了我就是萌 提交于 2019-11-26 07:58:27
问题 After my user clicks a button, I\'d like that button to stay pushed during the time that I perform a network operation. When the network operation is complete, I want the button to return to its default state. I\'ve tried calling - [UIButton setSelected:YES] right after the button push (with a corresponding call to - [UIButton setSelected:NO] after my network op finishes) but it doesn\'t seem to do anything. Same thing if I call setHighlighted: . I suppose I could try swapping out the

What values can appear in the “selected” attribute of the “option” tag?

吃可爱长大的小学妹 提交于 2019-11-26 04:48:20
问题 I have some markup similar to the following: <select> <option selected=\"selected\">Apple</option> <option selected=\"\">Orange</option> </select> In this case, \"Orange\" shows as the selected item. I would have expected making the selected attribute blank would undo its effects. Is there a way to write this without simply leaving the attribute out? 回答1: Different browser may treat this attribute differently. According to the MSDN documentation (for Internet Explorer): To select an item in

Setting “checked” for a checkbox with jQuery?

心不动则不痛 提交于 2019-11-26 01:17:33
问题 I\'d like to do something like this to tick a checkbox using jQuery : $(\".myCheckBox\").checked(true); or $(\".myCheckBox\").selected(true); Does such a thing exist? 回答1: Modern jQuery Use .prop(): $('.myCheckbox').prop('checked', true); $('.myCheckbox').prop('checked', false); DOM API If you're working with just one element, you can always just access the underlying HTMLInputElement and modify its .checked property: $('.myCheckbox')[0].checked = true; $('.myCheckbox')[0].checked = false;

How to set a selected option of a dropdown list control using angular JS

隐身守侯 提交于 2019-11-25 21:20:05
I am using Angular JS and I need to set a selected option of a dropdown list control using angular JS. Forgive me if this is ridiculous but I am new with Angular JS Here is the dropdown list control of my html <select ng-required="item.id==8 && item.quantity > 0" name="posterVariants" ng-show="item.id==8" ng-model="item.selectedVariant" ng-change="calculateServicesSubTotal(item)" ng-options="v.name for v in variants | filter:{type:2}"> </select> After it gets populated I get <select ng-options="v.name for v in variants | filter:{type:2}" ng-change="calculateServicesSubTotal(item)" ng-model=