click

How can I get the mouse coordinates related to a panel?

微笑、不失礼 提交于 2019-12-18 07:11:30
问题 I am trying to get the coordinates of a click with the mouse in C# related to a panel in my form, but I don't know how to do that. I'm a begginer and I don't have any experience with events. Thanks! 回答1: You must subscribe to event of Panel control - Click event. You can write the code below within Form's contructor: System.Windows.Forms.Panel panel; public Form() { InitializeComponent(); panel = new System.Windows.Forms.Panel(); panel.Location = new System.Drawing.Point(82, 132); panel.Size

jQuery change CSS after a certain amount of time

吃可爱长大的小学妹 提交于 2019-12-18 06:48:38
问题 I have a navigation that, when one of it's nav items is clicked, will use jQuery to change it's z-index to 0. Then, after 2 seconds, I would like the z-index to be changed to 2. I tried using delay() but apparently that doesn't work when changing the CSS. 回答1: Use a setTimeout like this $(elem).css('z-index','0'); setTimeout(function(){ $(elem).css('z-index','2'); },2000) 回答2: In javascript you can use either setTimeout or setInterval to accomplish that setTimeout("javascript statement"

jQuery on click $(document) - get clicked element

天涯浪子 提交于 2019-12-18 04:37:13
问题 I'm trying to figure out how to get the clicked element whey using $(document).click() method: $(document).click(function() { if ($(this) !== obj) { obj2.hide(); } }); In the example above the obj is the object is the dropdown menu - and if clicked I don't want it to do anything, but if the click was on the body of the page or any other element - it should trigger the hide() method. 回答1: You can use event.target. You should also compare DOM elements instead of jQuery objects, since two jQuery

C# dynamically add event handler

ぃ、小莉子 提交于 2019-12-18 04:30:15
问题 Hi i have a simple question. here is my code: XmlDocument xmlData = new XmlDocument(); xmlData.Load("xml.xml"); /* Load announcements first */ XmlNodeList announcements = xmlData.GetElementsByTagName("announcement"); for (int i = 0; i < announcements.Count; i++) { ToolStripMenuItem item = new ToolStripMenuItem(); item.Name = announcements[i].FirstChild.InnerText; item.Text = announcements[i].FirstChild.InnerText; /* HERE IS WERE I NEED HELP */ item.Click += new EventHandler(); this

Why is my click event called twice in jquery?

时间秒杀一切 提交于 2019-12-18 03:32:31
问题 Why is my click event fired twice in jquery? HTML <ul class=submenu> <li><label for=toggle><input id=toggle type=checkbox checked>Show</label></li> </ul> Javascript $("ul.submenu li:contains('Show')").on("click", function(e) { console.log("toggle"); if ($(this).find("[type=checkbox]").is(":checked")) console.log("Show"); else console.log("Hide"); }); This is what I get in console: toggle menu.js:39 Show menu.js:40 toggle menu.js:39 Hide menu.js:41 > $("ul.submenu li:contains('Show')") [<li>​

if conditional statement not working with IE 11 [duplicate]

拈花ヽ惹草 提交于 2019-12-18 03:10:43
问题 This question already has answers here : IF IE conditionals not working (5 answers) Closed 5 years ago . I am using IE 11 version. Is there any other solution to do the following: Nothing happens when I try to use conditional IE clause in the html webapge. Can anyone help me debug this issue please. <!--[if IE]> <a href="next-page.php" class="start-button">CLICK ME</a> <![endif]--> 回答1: Conditional statements do not work in IE 10 or 11 Support for conditional comments has been removed in

Android clickable layout

时光总嘲笑我的痴心妄想 提交于 2019-12-18 02:41:34
问题 I've got a linear layout that i have set true to be clikable + focus, But the problem is there is no focus displayed when clicked. How can i get the focus to be displayed. Heres my code <LinearLayout android:id="@+id/linear_tv_layout" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:clickable="true" android:focusable="true" android:paddingBottom="7px"> 回答1: I think you need to set as background for the

Hide particular div onload and then show div after click

╄→尐↘猪︶ㄣ 提交于 2019-12-17 22:51:10
问题 I have two divs div1 and div2 . I want div2 to be automatically hidden but when i click on preview div then div2 to be made visible and div1 to hide. This is the code i tried but no luck :( <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("div2").hide(); $("#preview").click(function() { $("#div1").hide(); $("#div2").show(); }); }); </script> <div id="div1"> This is preview Div1. This is

jQuery click off element event

爷,独闯天下 提交于 2019-12-17 21:48:44
问题 I have a floating div that gets displayed, and I want it to be hidden when the user clicks off the div. This would be similar to the .hover() function callback when hovering off an element. Only I want to do this for click. I tried just setting a click event for the body, which would hide the div, but that gave unexpected results. Anyone have ideas on how I could easily do this? 回答1: Another, possibly simpler, option would be to add a transparent div between the floating DIV and the rest of

Use VBA code to click on a button on webpage

谁都会走 提交于 2019-12-17 21:28:21
问题 I am editing a vba program and want to code the vba to click on a button in a webpage. The html for the button is: <input type="image" src="/lihtml/test_button3.gif" align="left" alt="File_Certificate_Go"/> I imagine I would have to set a variable to getElementBy??? and then variable.click, but I can't figure out how exactly to get the element (because it doesn't have a name or id, and I can't give it one because it is not my webpage). Any help is greatly appreciated! 回答1: Perhaps something