Double-click Online Dictionary Definition Script?

Sep 3, 2009

I've always wanted to help second-language English speakers access my site better, by offering a 'double-click on a word' definition in other languages. I had a useful script for some years which was rather dated, and ceased to work if there was an iframe on the page for some reason. Anyway, I found a very good solution at [URL]However, this opens the definition in a new tab/window.

Having experimented with it opening in a popup, I found problems in getting the popup to regain focus if someone had not closed it before looking for another definition. And anyway, popups can get blocked. So I found a nice layer/iframe solution at [URL] though their positioning of the layer is poor, at least in FF because it slides too far down below the bottom of the page. Their script is: [URL]I have modified that to work with dictionarist and stripped out their own floating part of the script, so that it works with position fixed for everything except IE6. But for IE6, I need to still change this from position fixed to position absolute, and then use a script to float the box.I have been trying the script I use successfully elsewhere in a vaguely similar context:

Code:

/* Script by: www.jtricks.com
* Version: 20060303
* Latest version:

[code]....

which has a call to startFloat(); near the end, which is based on their own floating script nearer the top of [URL] which I have removed. (Doubtless the references to Netscape (RIP) can be removed.)

View 4 Replies


ADVERTISEMENT

Dictionary Page - Display Definition Of Word OnClick

Oct 9, 2009

I am doing a distionary page with javascript and I am trying to get it so that the definitions come up when the word they are for is clicked on.

Here is my javascript
Javascript Document
var filename = "dictionary.js";
function loaded(which){
alert(which + " loaded");
}/**/
function showInfo(which){
var placeholder = document.getElementById("definition");
var source = whichInfo.getAttribute("href");
placeholder.setAttribute(source);
alert("showInfo called");
return false;
}function prepareList(){
if (!document.getElementsByTagName || !document.getElementById)
return false;
var words = document.getElementById("words");
if (!words) return false;
var links = words.getElementsByTagName("a");
for(var i = 0; i < links.length; i++) {
links[i].onclick = function(){
showInfo(this);
return false;
}}
alert("prepare list done");
}function init(){
prepareList();
}loaded(filename);
window.onload = init;

Here is my html
<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 StrictEN" "[URL]">
<html xmlns="[URL]">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Dictionary DOM Scripting</title>
<link href="../styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="dictionaryScripts/dictionary.js"> </script>
</head><body>
<div class="page">
<div class="nav"><ul>
<li><a href="../home.html">Home</a></li>
<li><a href="../form/form.html">Form</a></li>
<li><a href="dictionaryCSS.html">Dictionary with CSS</a></li>
<li><a href="dictionaryDOM.html">Dictionary with DOM scripting</a></li>
<li><a href="discussionPage.html">Discussion</a></li>
</ul></div><div class="header">
<h1>Dictionary with DOM Scripting</h1></div>
<div class="mainContent">
<div id="words"><h2>L</h2>
<p>Click on the word to get a definition</p>
<dt><a href="lecturer.html">LECTURER, n.</a></dt>
<dt><a href="learning.html">LEARNING, n</a></dt>
<dt><a href="liar.html">LIAR, n.</a></dt>
<dt><a href="love.html">LOVE, n.</a></dt></div>
<div id="definition">Choose a definition</div>
</div></div></body></html>

View 5 Replies View Related

JQuery :: My .click With UI Dialog Is Making Me Have To Double Click Instead Of One Click To Open It?

Jul 13, 2009

I cant really figure this out, the only thing i could see messing it up is the javascript:void(0) inside the anchor link but since there is a double click function and a click, it should only be one click.I put autoOpen which i think is also causing it, but i did that so theuser can open it, close it, and open it again so the delay "double click" is saying for the first time initialize and then the second click is opening?? if so how do i get around this?

HERE IS MY JQUERY
$(document).ready(function(){
$("#pro_edit_profile").hide();[code]....

HERE IS MY HTML FOR THE LINK

<a href="javascript:void(0);" id="pro_edit_pic_link" name="Change
Profile Picture">Change Profile Picture</a>

View 1 Replies View Related

Display Box With Expanded Definition On Click?

Oct 16, 2010

I have pairs of terms and short definitions in a table. I want to display a longer definition in a box below the terms table when the term is clicked on. The box needs to disappear if clicked on. [code]...

View 6 Replies View Related

JQuery :: Losing Object Definition On Return To A Click Handler?

Feb 8, 2011

I am looping through an array of objects and creating an <li> element for each one and appending to a <ul> in the DOM. Works fine.During the looping I am also attached a 'details' object as data for the list element:$(thisListItem).data('details',{<obj>});Later, I am using the selector:$('ul#images_list li')to attach an on click function for each <li> element.In the click handler I am reading the data 'details' object for the <li> element:dataDetails = $.data(lotImage,'details');and, using the jAlerts plugin, I am opening a jPrompt which asks for the user to enter a price.

The jPrompt call includes a callback which receives the entered value as a parameter. The callback uses the value to 'post' the updated value, via $.ajax, to a server side unction.After OK is clicked in the jPrompt popup, in Firebug, I get an error that the dataDetails is undefined and it lists the line number in the click handler where I originally read the data object from the <li> element.I don't really understand why it should care after the click event has fired and the jPrompt callback has been invoked

View 3 Replies View Related

JQuery :: Convert Single Click To Double Click?

Jul 13, 2009

<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>emailsig.html</title><meta name="viewport" content="width = 400, minimum-scale = 0.25, maximum-scale = 1.60"><meta name="title" content="html email signature"><style type="text/css"> <!-- body { margin:0px; background-color:#fff; height:100% } html { height:100% } img { margin:0px; border-style:none } button { margin:0px; border-

[Code]...

View 2 Replies View Related

Double Click Or Single Click?

Mar 18, 2010

Ok know those people who are in the bad habit of double clicking everything? Well my site breaks if they double click it...

is there a script I can use that won't let my functions run more then once every so many seconds? to avoid double clicking errors?

View 12 Replies View Related

Double Click Event

Jul 23, 2005

Is there such a thin as the "double click" event?

Something like onclick="dothestuff"..... would there be something like
ondoubleclick="dothestuff" ?

View 1 Replies View Related

Double Click To Remove?

Oct 31, 2011

I've been working with this script function changeImage(layer_id, item_id, position) {

var theDiv = document.getElementById(layer_id);
var theImg = (theDiv != null) ? theDiv.firstChild : null;
if (theImg != null) {
// If the item id is 0, then just make the image empty lol
if (item_id == 0)

where layer_id, item_id, and position are all defined elsewhere. I've been trying to get the images to append, and then run this line theDiv.parentNode.removeChild(theDiv) when you click on them consecutively(click to append, click again to remove, so three consecutive clicks would have the image shown and four would not), but all I've succeeded at so far is breaking the script's functionality.

View 5 Replies View Related

Disable Double-click Selection

Jul 20, 2005

i have a page with a table, and when the user doubleclicks a row in
it, a window is opened. The problem is, if he doubleclicked a text in
the row, it's becoming selected.

what i want is to disable the selection upon doubleclicking, but no
the selection at all (so that the user can still just use the mouse to
select some text in the table).

is there a javascript command that can disable the selection currently
highlighted?

View 1 Replies View Related

Double Click Background To Edit?

Dec 23, 2005

I'm wondering how I can have the same function thats used on this site,
has any one here every noticed that if you view the topic list on this site, and double click on a topic that you made, it brings up an edit option for the subject? just wondering how this is done? Code:

View 10 Replies View Related

Double Click To Submit Form?

Apr 2, 2009

I have a form that consists of a <select> element and a submit button. The user picks an option, then clicks the submit button to go to the next step. However, I'd also like to add the option to submit the form when the <option> is double-clicked on.I've tried using the following to no avail:

Code JavaScript:
function submitform()
{

[code]....

View 5 Replies View Related

Double Click On A HTML Element?

May 30, 2011

In one of my webpage, I have a text field, upon double clicking on that text field, a look up table gets opened so that I can select a value on it.

There is no other way to open the lookup table other than double clicking on it.

How to double click on a text field using javascript. (In fact, how to double click on any HTML element). I cannot change the functionality of the web page to resolve this issue since the webpage was developed by me.

All I have to do is, I have to double click on the text field using javascript.

View 4 Replies View Related

JQuery :: Double Click To Trigger A Function?

Feb 8, 2011

I want to include a number of boxes on a page that reveal content when clicked. I seem to have these working ok, although when one box is open, i have to click twice on another to get it to work.

You can view this in action here:[URL]... Is there a way i can stop this from happening?

View 2 Replies View Related

JQuery :: Toggle Breaks On Double Click?

Dec 16, 2010

I have a click function that works perfectly when you click so. As soon as there's an animation on toggle() such as Blind or Slide, it no longer toggles.

here's my code:
// Accordion
$('#accordion h3').click(function() {
$(this).next().toggle('blind');
$(this).toggleClass('ui-state-active');

[Code]....

When I change it to toggle() with no animation, works perfectly fine and I can click as fast as I want.

what should I do to say if it's already animated. is(":animated") ?

View 1 Replies View Related

Prevent Button Click Double Times

Mar 31, 2011

I have webform ,in that we have written some javascript for validation .we are calling this validatation while saving the form by using on client click event .Now we want to prevent the double time clicking the button .I have rounded the entire net but none of the code is not working because we have already calling the on client click function .I tried by calling 2 functions in on client click .But no use.

View 2 Replies View Related

JQuery :: .toggle() - Only Toggling On Double Click?

Jun 24, 2009

I'm attempting to switch the html inside of a <div> from MORE to LESS when clicked. The issue is that it takes two clicks to switch the text. You can see an live example here:

[URL]

Here's my jQuery:

Code:

$(document).ready(function() {
$('#military-box-one').hide();
$('#more-one').click(function() {

[code]....

View 1 Replies View Related

JQuery :: FadeOut() Animation - Double Mouse Click

Jan 15, 2011

I have this code:

This jQuery-script is simple, I think, you understand, how it works. The my goal is: Then I click on item in the "items" block the item is moving to "basket" item. And, then I click on item in "basket" the item is moving to items" block. And, problem is: then I quickly (double mouse click) click on item, it clones to "basket" (or "items") block more than 1 times. I think, this problem occurs until fadeOut() animation isn't end ...

View 2 Replies View Related

Why Hide / Show Requires Double Click First Time

Feb 14, 2011

I'm testing a page with a .js hide/show <div> overlay to hide/show a video player. The image of the video screen in the center of the page, when clicked, opens a hidden <div> overlay. It works but it requires the viewer to double click the first time. What needs to change to make it "show" the <div> on the first click? Once the video <div> is displayed, then it works every time with just one click to hide or show. It's just the first time that requires two clicks to get it to work. Here is the page: [URL]

Here is the code used to implement the hide show, in the <head>:

Code:
<!-- Elements Needed for Video Player Popup -->
<!-- The javascript hide/show -->
<script type="text/javascript" language="JavaScript">
<!--
function HideContent(d) {
document.getElementById(d).style.display = "none";
} function ShowContent(d) {
document.getElementById(d).style.display = "block";
} function ReverseDisplay(d) {
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
} //-->
</script>
a
And on the image, which acts as the button:
Code:
<a href="javascript:ReverseDisplay('mediaspace2')">
<img src="images/vid_button_image.jpg" width="376" height="282" border="0" /></a>

View 4 Replies View Related

JQuery :: Double Click Scroll Button After Page Load

Nov 16, 2010

I recently added a section to my website that uses the Scrollable JQuery tool to load images from my Flickr account. When I initially load the page the "next" button requires two clicks before it will advance to the next set of images. This only happens on the first attempt following the page load. When I look at the code it appears that Scrollable fires an event on the first click that removes the "disabled" class on the "prev" anchor tag. It appears to skip the slider event that scrolls the images. You can view the issue here: [URL].

View 2 Replies View Related

Double Click A List Item That Fires A Modal Popup

Jun 3, 2009

Firstly, I dont even know if this is possible but anyway I have a HTML form element problem, I want to be able to double click one item in a multi select box and I want that double click to fire of a modal popup box.

I am able to get a regular hyperlink to do the action for me but I need it to be an item in a multi select box.

I have uploaded an example of my problem here,[url].

so for example i would like a popup to appear when you double click "volvo" just like the popup appears for the hyperlink at the bottom.

View 4 Replies View Related

Double Click An Item In A Multi-Line Text Field

Jul 5, 2002

Anyone know whether it's possible to allow users to double click items of a multi-line text field? Of course, I want the double click to take them to another URL

View 10 Replies View Related

Code For Detecting Long Press/ Double Click In Android Browsers?

Oct 11, 2011

I am working in web application project. In this on a div i have double click event to open a popup box, in android browser if i did double click then it fires zoom in event. Please any one help me javascript code for detecting long press/ double click vent in android browsers.

View 1 Replies View Related

Dictionary Class

Sep 18, 2002

here's something like an associative array implementation...

/*
File: Dictionary.js
Version: 1.0
Last modified: 09.17.2002
Author: Alexandar Minkovsky (a_minkovsky@hotmail.com ; URL: http://www24.brinkster.com/alekz)
Copyright: Left
Type: Class
Exports: Dictionary class.
Dependencies: None.
Description:
Similar to ASP "Scripting.Dictionary" Object, or an associative array
with somewhat limited functionality. There's a few differences:
- "item" property is replaced by two methods getVal and setVal.
- "key" property is replaced by the setKey method.
As the value of an item can be virtually anything, even another Dictionary object,
the Dictionary Class might be usefull.
If someone have a suggestion or wants the Dictionary class to be extended some way,
feel free to drop me an e-mail.
Tested with: IE4; IE5; IE5.5; IE6; NS4.78; NS6.0; NS6.1; NS6.2; NS7.0; Mozilla 1.0; Mozilla 1.1; Opera 6.0
*/
/*
================
Dictionary Class
================
- Instanciating
oDict = new Dictionary();

- Properties
~ Public
(int) count - Number of keys in the Dictionary. Default: 0. Read only, do never manually set this property!
~ Private
(Object) Obj - the object actually containing the data. Do never use it directly.

- Methods - look at the function descriptions for detailed explanation.
~ Public
(BOOL) exists(sKey)
(BOOL) add (sKey,aVal)
(BOOL) remove(sKey)
(void) removeAll()
(Array) values()
(Array) keys()
(Array) items()
(Any) getVal(sKey)
(void) setVal(sKey,aVal)
(void) setKey(sKey,sNewKey)
*/
//****************************************
//Dictionary Object
//****************************************
/*
function: Dictionary
Parameters: None
Returns: A new Dictionary object.
Actions: Constructor.
*/
function Dictionary(){
//Properties
//~Public
this.count = 0;
//~Private
this.Obj = new Object();
//Methods
//~Public
this.exists = Dictionary_exists;
this.add = Dictionary_add;
this.remove = Dictionary_remove;
this.removeAll = Dictionary_removeAll;
this.values = Dictionary_values;
this.keys = Dictionary_keys;
this.items = Dictionary_items;
this.getVal = Dictionary_getVal;
this.setVal = Dictionary_setVal;
this.setKey = Dictionary_setKey;
}
//****************************************
//Method implementations
//****************************************
/*
function: Dictionary_exists
implements: Dictionary.exists
Parameters:
(String) sKey - Key name being looked for.
Returns: (BOOL) - true if sKey is found ; false if it is not.
Actions: Iterates through all Dictionary keys and checks for sKey.
*/
function Dictionary_exists(sKey){
return (this.Obj[sKey])?true:false;
}
//****************************************
/*
function: Dictionary_add
implements: Dictionary.add
Parameters:
(String) sKey - Key name to be added.
(Any) aVal - Value to be associated with sKey.
Returns: (BOOL) - true if sKey is created ; false if it is not (because of a duplicate Key name).
Actions: Adds a new Key=Value pair to the Dictionary.
*/
function Dictionary_add(sKey,aVal){
var K = String(sKey);
if(this.exists(K)) return false;
this.Obj[K] = aVal;
this.count++;
return true;
}
//****************************************
/*
function Dictionary_remove
implements: Dictionary.remove
Parameters:
(String) sKey - Key to be removed.
Returns: (BOOL) - true if sKey has been removed ; false if it has not (did not exist).
Actions: Removes a specified key from the Dictionary.
*/
function Dictionary_remove(sKey){
var K = String(sKey);
if(!this.exists(K)) return false;
delete this.Obj[K];
this.count--;
return true;
}
//****************************************
/*
function: Dictionary_removeAll
implements: Dictionary.removeAll
Parameters: None
Returns: Nothing
Actions: Removes all key=value pairs from a Dictionary object.
*/
function Dictionary_removeAll(){
for(var key in this.Obj) delete this.Obj[key];
this.count = 0;
}
//****************************************
/*
function: Dictionary_values
implements: Dictionary.values
Parameters: None
Returns: Returns an Array containing all the item values in a Dictionary object.
Actions: Iterates through the Dictionary name=value pairs and builds an Array of all values.
*/
function Dictionary_values(){
var Arr = new Array();
for(var key in this.Obj) Arr[Arr.length] = this.Obj[key];
return Arr;
}
//****************************************
/*
function: Dictionary_keys
implements: Dictionary.keys
Parameters: None
Returns: Returns an Array containing all existing keys in a Dictionary object.
Actions: Iterates through the Dictionary name=value pairs and builds an Array of all keys.
*/
function Dictionary_keys(){
var Arr = new Array();
for(var key in this.Obj) Arr[Arr.length] = key;
return Arr;
}
//****************************************
/*
function: Dictionary_items
implements: Dictionary.items
Parameters: None
Returns: Returns a bidimensional Array containing all existing keys=value pairs in a Dictionary object.
Actions:
- Iterates through the Dictionary key=value pairs and builds a bidimensional Array.
- First index contains the key name ; second index contains the value:
ex. Arr[0][0] is the key name of the first Dictionary item
Arr[0][1] is the value of the first Dictionary item
*/
function Dictionary_items(){
var Arr = new Array();
for(var key in this.Obj){
var A = new Array(key,this.Obj[key]);
Arr[Arr.length] = A;
}
return Arr;
}
//****************************************
/*
function: Dictionary_getVal
implements: Dictionary.getVal
Parameters:
(String) sKey
Returns: Item value for the passed sKey.
Actions: Retrieves the Dictionary item value corresponding to sKey.
*/
function Dictionary_getVal(sKey){
var K = String(sKey);
return this.Obj[K];
}
//****************************************
/*
function: Dictionary_setVal
implements: Dictionary.setVal
Parameters:
(String) sKey
(Any) aVal
Returns: Nothing.
Actions:
- Sets the Dictionary item value corresponding to sKey to aVal.
- If The key is not found in the dictionary it is created.
*/
function Dictionary_setVal(sKey,aVal){
var K = String(sKey);
if(this.exists(K))
this.Obj[K] = aVal;
else
this.add(K,aVal);
}
//****************************************
/*
function: Dictionary_setKey
implements: Dictionary.setKey
Parameters:
(String) sKey
(String) sNewKey
Returns: Nothing.
Actions:
- Changes sKey to sNewKey
- if sKey is not found, creates a new item with key=sNewKey and value=null
- if sKey is not found, but sNewKey is found - does nothing.
- if sKey and sNewKey both exist - does nothing.
*/
function Dictionary_setKey(sKey,sNewKey){
var K = String(sKey);
var Nk = String(sNewKey);
if(this.exists(K)){
if(!this.exists(Nk)){
this.add(Nk,this.getVal(K));
this.remove(K);
}
}
else if(!this.exists(Nk)) this.add(Nk,null);
}
//****************************************

View 2 Replies View Related

Portable Dictionary Class

Aug 23, 2007

Can you show me an example of a working dictionary object that is
portable? I would like to have something like:

d = new PortableDict()

d.setValue('a',12)
d.setValue('b',-3)

subd = new PortableDict()
d.setValue(subd,51)

d.hasKey('a') // true
d.hasKey('c') // false
d.hasKey(subd) // true
d.getValue('a') // 12

etc.

Alternatively, is there a programming scheme that allows me to assign
custom properties/attributes to DOM elements? I can do it with
FireFox, but not with IE - it throws an error telling that the given
attribute is not supported. Which is strange because AFAIK in
JavaScript you can freely modify objects, add attributes and methods
on the fly. But it looks like that in IE, HTML DOM elements are not
real JavaScript objects.

View 8 Replies View Related

Dictionary Bookmarklet To Open In New Window

Aug 6, 2010

How could I make this useful dictionary bookmarklet open in a new window?

javascript:var%20t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));var%20e=(document.charset||document.characterSet);if(t!=''){ location.href='http://translate.google.com/translate_t?text='+t+'&hl=en&langpair=auto|en&tbb=1&ie='+e;}else{location.href='http://translate.google.com/translate?u='+escape(location.href)+'&hl=en&langpair=auto|en&tbb=1&ie='+e;};

Its the "To English" bookmarklet as featured on lifehacker (http://lifehacker.com/5168984/to-english-bookmarklet-quickly-easily-translates-any-text-with-one-click).

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved