dhtml

Free-Form Date Picker - like RTM

随声附和 提交于 2020-01-01 19:17:37
问题 I'm looking for a way to have a textbox that allows users to type in a date in any format and turns around and formats that date in a 'mm/dd/yyyy' format. So the user could type in "Today" and it would turn the date as 02/24/2009 or they could type in Wednesday Feb 24 and formatting would automatically pick up. Remember the Milk does this (but I believe server side). This is asp.net so I could do via ajax web service call but I would prefer to do this via Javascript. I'm looking for a general

IE is not submitting dynamically added form elements

我们两清 提交于 2020-01-01 08:49:56
问题 I wrote some JavaScript to allow editing a list of items within an HTML form, including adding and removing items. Got it working in Firefox. When trying it in Internet Explorer, I found that any added items were not being submitted with the form. Long story short... lots of simplification, debugging, figured out what line is triggering IE to ignore the new form input. So the behavior problem is solved. But now I must ask: Why? Is this an IE bug? Here is the simplified code: <html> <head>

Is JavaScript single threaded? If not, how do I get synchronized access to shared data?

一曲冷凌霜 提交于 2019-12-29 06:21:11
问题 I have a web page with DIV s with a mouseover handler that is intended to show a pop-up information bubble. I don't want more than one info bubble to be visible at a time. But when the user moves the mouse rapidly over two items, I sometimes get two bubbles. This should not happen, because the code for showing a pop-up cancels the previous pop-up. If this were a multi-threaded system then the problem would be obvious: there are two threads trying to show a pop-up, and they both cancel

jQuery get the id/value of <li> element after click function

北战南征 提交于 2019-12-27 17:01:36
问题 How can I alert the id of the <li> item clicked? <ul id='myid'> <li id='1'>First</li> <li id='2'>Second</li> <li id='3'>Third</li> <li id='4'>Fourth</li> <li id='5'>Fifth</li> </ul> (Anything that can replace the id may be value or something else will also work.) 回答1: $("#myid li").click(function() { alert(this.id); // id of clicked li by directly accessing DOMElement property alert($(this).attr('id')); // jQuery's .attr() method, same but more verbose alert($(this).html()); // gets innerHTML

jQuery get the id/value of <li> element after click function

梦想与她 提交于 2019-12-27 17:01:29
问题 How can I alert the id of the <li> item clicked? <ul id='myid'> <li id='1'>First</li> <li id='2'>Second</li> <li id='3'>Third</li> <li id='4'>Fourth</li> <li id='5'>Fifth</li> </ul> (Anything that can replace the id may be value or something else will also work.) 回答1: $("#myid li").click(function() { alert(this.id); // id of clicked li by directly accessing DOMElement property alert($(this).attr('id')); // jQuery's .attr() method, same but more verbose alert($(this).html()); // gets innerHTML

How do I programmatically click on an element in JavaScript?

試著忘記壹切 提交于 2019-12-27 11:01:18
问题 In IE, I can just call element.click() from JavaScript - how do I accomplish the same task in Firefox? Ideally I'd like to have some JavaScript that would work equally well cross-browser, but if necessary I'll have different per-browser JavaScript for this. 回答1: The document.createEvent documentation says that " The createEvent method is deprecated. Use event constructors instead. " So you should use this method instead: var clickEvent = new MouseEvent("click", { "view": window, "bubbles":

Change :hover CSS properties with JavaScript

馋奶兔 提交于 2019-12-27 10:36:11
问题 I need to find a way to change CSS :hover properties using JavaScript. For example, suppose I have this HTML code: <table> <tr> <td>Hover 1</td> <td>Hover 2</td> </tr> </table> And the following CSS code: table td:hover { background:#ff0000; } I would like to use JavaScript to change the <td> hover properties to, say, background:#00ff00. know I could access the style background property using JavaScript as: document.getElementsByTagName("td").style.background="#00ff00"; But I don't know of a

Displaying change of content through parent

一个人想着一个人 提交于 2019-12-25 09:43:17
问题 I have DHTML content inside a fieldset . This includes plain html, nested objects (even other fieldsets), and value change of input , select , and textarea objects. I'd like to change the border of the fieldset if the contents have been changed. The following works: $('fieldset[name=qsfs127]').children('input').change(function(){ $(this).parent('fieldset').css({border:'1px solid red'}); }) This handles the input; I can extend it to select and textarea. Questions : How can I do the same for

How do I create form controls dynamically with DHTML and deal all those with JSF?

谁说胖子不能爱 提交于 2019-12-24 17:53:27
问题 Suppose this next situation: making a view where the form controls are rendered with DHTML (that is, each time the user press a button, a new row with fields is created and field identifiers are both generated and asigned to the fields with the same DHTML as 'form1control1' and so on), but where that controls are not related yet to any UIComponent in the ViewRoot (as they are created dynamically by the client and so the server don't know they are in the form) How can I deal with a) finding

Dynamically hide form on submit?

a 夏天 提交于 2019-12-24 06:48:33
问题 I am not a big web programmer, and have a friend who wants me to help him with something. He wants to be able to have a form that once it is submitted changes to say something like "Thanks for submitting" and have the form info disappear. He wants it to be easy for anyone to use, so he can give it to various people to use on their sites. I was thinking I could use javascript to do it, but not really 100% sure. I want to avoid anything that isn't HTML as much as possible so that it will be