dhtml

jQuery enable/disable show/hide button w/ SELECT options. Get remaining option values

烈酒焚心 提交于 2019-12-20 03:29:07
问题 I have a select list which is being populated using the values from a text field. I also have two buttons: an add button which adds the entered value to the select list and a remove button which removes the entered value from the select list. I would like to do the following using jQuery: If the value entered into the text field is NOT AVAILABLE in the select list, show the add button and hide the remove button. If the value entered into the text field is AVAILABLE in the select list, hide

Why is my TinyMCE hidden textarea acting up?

拜拜、爱过 提交于 2019-12-19 05:44:30
问题 I have about 7 textarea s on a web page, all of them are rich text editors using TinyMCE. However at page load only 1 of them is visible and the rest of them hidden. The user can click a 'show' link which would display the remaining textareas one by one. However, I have a weird problem. All the textarea s are setup like this: <textarea cols="40" rows="20"></textarea> However, only the textarea displayed on page load is the full size I want it to be. The remaining textarea s are really small

How can you check if your document is opened in an IFrame?

非 Y 不嫁゛ 提交于 2019-12-18 15:47:09
问题 Is there a way to know if your page is opened inside of an IFrame ? An idea I had was to see if the window object has a .parent property, but this apparently is also true of standalone windows which are opened by Javascript's window.open() function. 回答1: if (window.top != window.self) { } 来源: https://stackoverflow.com/questions/3918815/how-can-you-check-if-your-document-is-opened-in-an-iframe

How to create a modal popup using javascript and CSS

随声附和 提交于 2019-12-18 15:31:30
问题 Actually, two questions: How can I create a modal popup with background color of gray? Also I need to create for a cover background color only to table itself. Not to overall page. How do I do this using javascript and css? 回答1: Here is the HTML, which should probably be inserted with JS, and the styles should be in an external stylesheet. <div style="background: gray; width: 200px; height: 200px; position: absolute; left: 50%; top: 50%; margin-left: -100px; margin-top: -100px" id="modal">I'm

How to find selection in HTML document that contains iframe or just frames

99封情书 提交于 2019-12-18 13:37:38
问题 Is there a way to find the selected text in an HTML document if the text may be within one of its frames (or iframes)? If the document has no frames it's simple: var text; if (document.getSelection) { // Firefox and friends text = document.getSelection(); } else if (document.selection) { // IE text = document.selection.createRange(); } if (text == undefined || text == '') { // Iterate over all textarea elements and see if one of them has selection var areas = document.getElementsByTagName(

javascript WYSIWYG HTML editors?

☆樱花仙子☆ 提交于 2019-12-18 07:06:20
问题 What are the options for something that will let users make text bold/italic/underline/etc as they are writing in a textarea and work in all browsers? 回答1: Give a look to FKCEditor, I always recommend it... 回答2: I always liked TinyMCE http://tinymce.moxiecode.com/ 回答3: I favor the Rich Text Editor in the YUI 回答4: I've used InnovaStudio WYSIWYG. Pretty extensible and cheap. 回答5: FCKEditor is a popular choice, although it's incredibly bloated. There's a nice simple example in jQuery jQuery

Best Javascript drop-down menu? [closed]

不羁岁月 提交于 2019-12-18 03:56:29
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I am looking for a drop-down JavaScript menu. It should be the simplest and most elegant accessible menu that works in IE6 and Firefox

JQuery Mobile .page() function causes infinite loop?

荒凉一梦 提交于 2019-12-17 20:27:59
问题 I'm dynamically creating a listview with data from a AJAX response. It successfully creates the listview and populates it, but when i call JQM's .page() function on it, it seemingly goes into an infinite loop where the listview is appended forever. Is this a bug in JQM or am I doing something wrong? pageScript(function($context){ $context.bind("pagecreate", function(event, ui){ createMenu(); //function that deletes existing ul#menu and dynamically creates new one. $('ul#menu').page(); //here

Character offset in an Internet Explorer TextRange

人走茶凉 提交于 2019-12-17 20:25:42
问题 As far as I can tell there's no simple way of retrieving a character offset from a TextRange object in Internet Explorer. The W3C Range object has a node, and the offset into the text within that node. IE seems to just have pixel offsets. There are methods to create, extend and compare ranges, so it would be possible to write an algorithm to calculate the character offset, but I feel I must be missing something. So, what's the easiest way to calculate the character offset of the start of an

Change textNode value

强颜欢笑 提交于 2019-12-17 17:53:06
问题 Is there any way to change the value of a DOM textNode in web browser? I specifically want to see if I can change the existing node, rather than creating a new one. To clarify, I need to do this with Javascript. All text in the browser is stored in #textNodes which are children of other HTML nodes, but cannot have child nodes of their own. As answered below, content can be changed by setting the nodeValue property of these Objects. 回答1: If you have a specific node (of type #text) and want to