dhtml

Editing clipboard data when copying/pasting from a website

你离开我真会死。 提交于 2019-12-03 11:43:08
问题 I have seen a few sites now where if you highlight text of an article, copy it, and then paste in they can add more text to it. Try copying and pasting a section of text from an article at http://belfasttelegraph.co.uk/ and you'll see what I mean - they add a link to the original article in the pasted text. How is this done? I'm assuming there is some javascript at work here 回答1: This is a good effect, you can see the scripting that is fired on copy using Firebug (in Firefox). Start up

How to make a click or double click on a word on a web page to trigger an event handler?

佐手、 提交于 2019-12-03 07:32:18
问题 For a page like http://www.answers.com if the user double clicks on any word in the page, a pop up box will show up and shows the definition for that word. I can think of a way to use DOM scripting to break up all words in the page and then make each of them go under a separate "span" element... but otherwise isn't it true that if all the text is under a "p" element, then the "p" element node get triggered to handle the double click event, but there is no easy way of telling which word is

How can I force reflow after DHTML change in IE7?

允我心安 提交于 2019-12-03 07:04:35
问题 I have a page where the user can dynamically add file upload boxes. Adding the boxes changes the height of the div they are in, but certain elements of the div below it stay in the same place, so they start to overlap with the new DOM elements. This works correctly in IE8, Firefox, Chrome. How can I force IE7 to reflow the page with the new DHTML? The best solution I worked out was this: window.resizeBy(1, 0); setTimeout(UndoResize, 0); But it doesn't work with a maximized window (it restores

Replacing all children of a HTMLElement?

我与影子孤独终老i 提交于 2019-12-03 04:24:28
In my code, I fairly frequently need to replace all children of a certain HTML container with a new list of children. What is the fastest way to do this? My current approach is collecting all new elements into a DocumentFragment. The only way I've found to then actually replace the children is to remove all the children one by one, and append the fragment. Is there no faster way? Note: the solution needs not be cross-browser, but should preferably not require 3d-party components such as jQuery. The target-device is WebKit on a very slow CPU so I need to keep full control of any reflows. If you

How to make a click or double click on a word on a web page to trigger an event handler?

余生颓废 提交于 2019-12-02 22:19:49
For a page like http://www.answers.com if the user double clicks on any word in the page, a pop up box will show up and shows the definition for that word. I can think of a way to use DOM scripting to break up all words in the page and then make each of them go under a separate "span" element... but otherwise isn't it true that if all the text is under a "p" element, then the "p" element node get triggered to handle the double click event, but there is no easy way of telling which word is clicked on? You simply add a double click event to the entire document, like so: function get_selection()

How can I force reflow after DHTML change in IE7?

淺唱寂寞╮ 提交于 2019-12-02 20:41:26
I have a page where the user can dynamically add file upload boxes. Adding the boxes changes the height of the div they are in, but certain elements of the div below it stay in the same place, so they start to overlap with the new DOM elements. This works correctly in IE8, Firefox, Chrome. How can I force IE7 to reflow the page with the new DHTML? The best solution I worked out was this: window.resizeBy(1, 0); setTimeout(UndoResize, 0); But it doesn't work with a maximized window (it restores the window). Try: element.className = element.className; on the modified div (or possibly its parent,

php - how to change iframe different src after every 5 second

雨燕双飞 提交于 2019-12-02 17:41:51
问题 i have tried following code but it could change on click, i want to change the iframe inner part after every 5 second interval. <html> <body> <iframe id="foo"></iframe> <a href="http://www.mydomain.com" target="foo">This page</a> </body> </html> basically idea is that i have pages which will display inside of iframe, these 5 web pages will change after another after every 5 second interval. thanks 回答1: Based on @Matthew Dean answer : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional/

Live username lookup with AJAX/Jquery

好久不见. 提交于 2019-12-02 13:38:14
问题 I want to have a javascript function such as this: function isUsernameAvailable(username) { //Code to do an AJAX request and return true/false if // the username given is available or not } How can this be accomplished using Jquery or Xajax? 回答1: The big win when using AJAX is that it is asynchronous. You're asking for a synchronous function call. This can be done, but it might lock up the browser while it is waiting for the server. Using jquery: function isUsernameAvailable(username) { var

php - how to change iframe different src after every 5 second

一曲冷凌霜 提交于 2019-12-02 11:16:43
i have tried following code but it could change on click, i want to change the iframe inner part after every 5 second interval. <html> <body> <iframe id="foo"></iframe> <a href="http://www.mydomain.com" target="foo">This page</a> </body> </html> basically idea is that i have pages which will display inside of iframe, these 5 web pages will change after another after every 5 second interval. thanks e-Learner Based on @Matthew Dean answer : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999

JQuery pop up/ alert needed

南笙酒味 提交于 2019-12-02 08:40:59
I have a list of elements that need to have a corresponding pop up for each element. This is not a pop up where the background is blacked. This is more like a javascript alert although I need to create my own styled button within the pop up with our own bespoke event assigned to it. I need each pop to position itself appropriately next to the relevant item within the UI. Whats the best way to do this? Are there any examples please? I only want the pop up to show when the visitor triggers an event. Many thanks, You can easily do this without using jQuery Plugins. I put together a little example