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");
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(){
return false;
alert("prepare list done");
}function init(){
window.onload = init;

Here is my html
<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 StrictEN" "[URL]">
<html xmlns="[URL]">
<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>
<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>

View 5 Replies


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:


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


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 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

Display Words In Red And Green In Such A Way That That Fist Word Should Be Red, 2nd Word Should Be Green?

Dec 24, 2010

I have a long paragraph and I have been asked to display words in red and green in such a way that that fist word should be red, 2nd word should be green, 3rd word should be red and 4th word should be green and so on. For example: this is just a sample.

View 3 Replies View Related

JQuery :: Display A Word Document Inside A UI Dialog?

Jul 7, 2011

Is it possible to display a word document inside a JQueryUI dialog?

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.
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(){
this.count = 0;
this.Obj = new Object();
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
(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
(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;
return true;
function Dictionary_remove
implements: Dictionary.remove
(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];
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.
- 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
(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
(String) sKey
(Any) aVal
Returns: Nothing.
- 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);
this.Obj[K] = aVal;
function: Dictionary_setKey
implements: Dictionary.setKey
(String) sKey
(String) sNewKey
Returns: Nothing.
- 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);
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()


subd = new PortableDict()

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


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

Get The Search Word - Find A Word Inside A String

Jun 15, 2011

I am trying to find a word inside a string.the search his going fine but I need to know which word has been found in the string.



Now in the string only one value can be found at a time.So its either a1 or a2 or so on.....

View 4 Replies View Related

Can Javascript Add Items To ASP/VBScript Dictionary Object?

Jul 23, 2005

I got two ASP pages. One is ASP email form (I'm using Persist ASP
Email component). Another one has all file links in it. For example,
when user click Outlook course hyperlink. It will pop up another
window with outlook course PDF file. (All PDF files are already in the

What I am trying to do is: When user click the "Add Email" hyperlink,
it will add that course name and filepath into ASP/VBScript Dictioanry
Object. After the user finish and click "Attach to email" button. All
the files will be attached in the email as an attachment.

Because I am not familar with VBScript. So, can Javascript add items
to ASP Dictionary Object?

View 3 Replies View Related

Output Word Occurrence From A Page?

Apr 20, 2010

Write a JavaScript program to calculate the statistics of words in a web page. When running the program in a web page, the script should output all words in descending order of their number of occurrences. The number of occurrences should be displayed along with the words. When two or more words have the same number of occurrences, order them alphabetically. The output should show up as a new web page when the program runs. HTML tags and scripts inside web pages should not be considered as words by the program. The program should run in all web pages, not just one page. I got python coding for it, but not sure for java, also how to order by descending order

import re
def addWord(token, frequencies):
count = 0
word = ''.join(token)


View 1 Replies View Related

Save Html Page As Word Document?

Mar 7, 2009

I have one save button in my html page and as soon as i click that button using javascript's onclick function the html/static page should be saved with .doc extension.As of now i want only the text in the html page to be saved as word document.But if possible suggest me for html pages with images too.I want the logic or sample source code for the above mentioned requirement

View 3 Replies View Related

Find And Replace All Instances Of A Word In The Page?

Apr 27, 2010

I am looking for a script that will find and replace all instances of a word in the page. how ever there might be more than one instance. I'm not that crash hot on javascript and all i have at the moment is:

This script should look for UNASSIGNED and replace it with nothing

HTML Code:
function func1() {
var str=document.getElementById("UNASSIGNED");
document.write(str.replace(/UNASSIGNED/g, ""));

Also wanting another script that searches for a string via ID. if the id has SP.XXX <-- XXX being random numbers then i want it to find the and replace this repeating occurrence with a

View 2 Replies View Related

Get MS Word Document Page Settings And Number Of Pages?

Aug 24, 2009

I need a suggestion or code in JavaScript which reads the MS Word document page settings and number of pages. I know how to open and read a MS Word document, but i couldn't able to get page properties.

View 1 Replies View Related

Cross Browser - With PlaySound - Speaker Icon On Page - Allows User To Click To Hear Pronunciation Of A Word

Oct 5, 2011

I have a website that I am maintaining that was built some time ago. There is a little speaker icon on a page that allows a user to click to hear the pronunciation of a word.

<script type="text/javascript" language="Javascript">

It does not work in all browsers and I am wondering what the alternative should be?

View 4 Replies View Related

OnClick Won't Work After Display Switch / Fix It?

Dec 6, 2009

I'm using a javascript file to switch out items when a thumbnail is clicked. This includes photo, title, description, price, size, quantity and add to cart button....

The original code on the html file works fine, but as soon as it is swapped by onclick, the 'add to cart' button does nothing! code...

and that adds the item to the cart just fine, but when a thumbnail is clicked on, activating the javascript file to switch out the item/elements, the 'add to cart' button no longer does anything... by the way, I am using simpleCart.js.

View 1 Replies View Related

Onclick Display Variable Content?

Nov 4, 2010

I'm trying to make a basic rss reader with a google reader-esque functionality of clicking on article names and being able to expand/collapse that article. I'm working on the expand part and am going crazy. I am having no trouble getting content and displaying it without the onclick function but when I try to integrate onclick I can just get the titles.


View 4 Replies View Related

Checkbox That Should Display An Alert Onclick

Sep 1, 2004

I am trying to get a checkbox to display an alert when the user clicks the checkbox for "other". Then if they click it again to unchedk it, it should not display the alert again. I keep getting an message that says not an object. Can anyone help me out with this? I have copied the code below for the checkboxes and the code that is in my .js file....

View 1 Replies View Related

Definition<b>s</b> Of Week Number?

Jul 23, 2005

Throughout the world in general, ISO 8601 Week Numbers are used, in
which weeks are numbered 01 upwards and Week 01 contains the first
Thursday of the Gregorian Calendar Year.

There are, however, odd parts of the world where that standard is not

Ignoring for the moment cases in which week 1 is not more-or-less at the
beginning of the calendar year, what other definitions, stated exactly,
are used?

View 4 Replies View Related

Using Eval() For Function Definition

Feb 19, 2007

I have this particular problem with eval() when using Microsoft
Internet Explorer, when trying to define an event handler. This is the

function BigObject()
this.items = new Array();
this.values = new Array();
this.addItem = function( item )
this.items[this.items.length] = item;
var i, length = this.items.length;
for ( i = 0; i < length; i++ )
this.items[i].onclick = function()
{ alert( this.values[i] ); };

However, this last code (makeHandlers() method) doesn't work since the
expression "this.values[i]" automatically belongs to this new
anonymous function, and therefore isn't valid (since the new anonymous
function(s) don't have the "values" attribute. So I tried the

this.items[i].onclick = eval( "function() { alert( " +
this.values[i] + "); }" );

and it worked! ... in Firefox only :( Internet explorer returns
"undefined" for eval( "function() { /* whatever */ ); } " ), for the
same things Firefox perfectly understands, and if I try to make it a
handler, an exception is fired in IE. What do I do? Did I come to the
right conclusion with IE or am I making a banal mistake? Do I need to
find another way of solving this or is there a fix to this solution?

View 7 Replies View Related

Q About Function Definition Syntax

Aug 23, 2007

I had a look at sIFR.js code after parsing it and I have a question
about function syntax. For example

var f=function(){
// statements here

What is the purpose if the second set of parentheses following the
closing brace? Is the intention to execute the function immediately
after it has been defined?

Most functions in sIFR.js do not have this syntax, but a few do.

View 1 Replies View Related

JQuery :: Onclick A Link, Want To Get Display Div In Other Frame

Nov 14, 2011

I am using two frames, left side frame, i am having four links...

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


On click of link1, a div should display inside the "content". On click of link2, another div should display inside the "content". Like this for all link, separate div should be displayed.

View 1 Replies View Related

DIV Doesn't Expand To Width After OnClick Display:inline?

Feb 25, 2009

I'm having an issue in that when I display:inline a DIV onClick, the DIV is not expanding to the width specified in the stylesheet. Similarly, my TDs would not use their colspan attribute.

View 4 Replies View Related

Function Definition Inside 'if' Statement

Oct 19, 2005

I debugged some html file and found this:

<script language="JavaScript">

if ( some_statement ) {

function MyFunction ( some_argument ) {





Is it allowed to define a function INSIDE some 'if' statement?

View 8 Replies View Related

Grab Elements Of DL ( Definition List )

Aug 30, 2006

I'm trying to grab all of the elements of a DL, specifically the <a href>'s
grouping them by the DD's. I suppose if I can just get them into groups I
can get the href's later. The hard part is getting them grouped as explained
below. For example...

<dl id="dlList">
<dt><a href="#2">DT Item1<span>(1)</span></a></dt>
<dd><a href="#">DD Item1<span>(2)</span></a></dd>
<dd><a href="#">DD Item2<span>(1)</span></a></dd>
<dd><a href="#">DD Item3<span>(1)</span></a></dd>

<dt><a href="#1">DT Item1<span>(1)</span></a></dt>
<dd><a href="#">DD Item1<span>(1)</span></a></dd>
<dd><a href="#">DD Item2<span>(1)</span></a></dd>

Is there a way to say, loop through the DL until it finds a DT. Whe it finds
one, grab it and all of the DD's that immediately follow it .. until it
comes to another DT. Group it with its DD's and continue until no more DT's
are found.

Then maybe take these collections and possibly populate an array with the

View 11 Replies View Related

Mouseover On Definition List Effect?

Oct 3, 2010

There is an effect I would like to do but I don't know how it is done. To see something like it go to:[URL].. then mouseover the right side items under "most recently". It seems like there is a dt link which when mouseover occurs the dd data is presented.

View 4 Replies View Related

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