Integrating Technology in the Foreign Language Classroom

  
Jean LeLoup & Bob Ponterio 
SUNY Cortland 
© 2008
Glossing or Annotating Text for the WWW
Annotating text in a web page with anchors

Select a word or expression or image to gloss. Create a Link using the selected text or image. 
 
In the Link dialog or property box, rather than inserting a link to a new web page, insert the JavaScript command to run the "feedback" utility:

javascript: feedback('gloss = annotate')

Make sure that it looks EXACTLY like this. Everything between the two single quotes will appear in the popup window. Naturally, you will change the text between the quotation marks to suit each individual annotation. If you need to use a single quote (i.e. an apostrophe) in your popup window, it must be immediately preceded by an "escape" character " \" .

javascript: feedback('All the president\'s men')


JavaScript link for Dreamweaver

JavaScript link for Nvu


Once the gloss is in place, test it to be sure it is working. There is also more than one way to encode the gloss in HTML. For example:

<a href="javascript:void(null)" onclick="feedback('test = test');">gloss</a>

You can also use links from images or buttons, mouseover, any event that can be used as a trigger.


The third technique for popup windows uses the built-in alert('message') function. This technique is much simpler because we do not need to bother with making a separate JavaScript program or function available in our web page, but it is also more limited and not as esthetically pleasing. What we are doing is using the built-in JavaScript alert function instead of the feedback function that we used in our first two examples:

<a href="javascript: alert('gloss = annotate')">gloss</a>

Now we can gloss a word without bothering with the SCRIPT tags.


A fourth technique for glossing a text does not employ pop-up windows but makes use of the tooltip. When you place your mouse over the link below, a tooltip will open and display the gloss. The tooltp text is stored in the title property of an html tag.

<a href="javascript:void(null)" title="information about an expression">gloss</a>

gloss

Tooltips are not limited to links like some of the other techniques we have seen. A title property can be added to any number of html tags such as format markup that span text or images. In the example below, we have a tooltip created by addint a title property to the image, to the bold <strong></strong> and green <font color='green'></font> markup, and by using a <span></span> tag.

Bob

In the following line, the words "kora", "n'goni" and "rendez-vous" are glossed.

La kora et le n’goni sont aussi au rendez-vous.

 

La <strong title='12 string instrument (cora)'>kora</strong> et le <font color="green" title='3-4 string instrument'>n&rsquo;goni</font> sont aussi au <span title='They are at the get-together.'>rendez-vous</span>.

In Nvu, you can edit title properties in the HTML Tags view.

Double-clicking on the SPAN tag brings up the Advanced Properties Editor.

 

Here we can add the title attribute by editing its value. The value is the text that will appear ("sample").

This is a test of glossing. 

Caveat! Using format tags to gloss text presents an inherent danger. If at some point you change the format, you might accidentally delete all of your glosses!


Don't forget that the link that opens your popup window can be the word that you are glossing, but it could also be any image.

<a href="javascript: alert('gloss = annotate')"><img src="gloss-5.jpg" width="310" height="57" border="0"></a>

In fact, it could also be a frame element such as a button.

<input name=1 type=BUTTON onClick="alert('gloss = annotate')" value="?">

A mouseover event or indeed practically any event could be used.


Fancier tricks for those who want to take it up a notch

There are also many free or inexpensive programs for making more sophisticated popup windows popup windows using Dynamic HTML (DHTML). These can create Layers that look like windows which remain inside of your main browser window. These can be hidden, moved, displayed, resized. Their contents can be altered using JavaScript. The popup on this page could be moved using your cursor, except that I made it disappear when the cursor touches it.

The first US president was:

Washington.  
Jefferson.  
Lincoln.  
Roosevelt.
Reagan

DHTML is beyond the scope of this course, so this little taste is purely optional. If you wish to explore these kinds of popup windows, search for "dhtml popup".

Note that the contents of some of the table cells above change when certain events (onmouseover, onmouseout) occur. Just to whet your appetite, we can change the contents of many objects (e.g. <Div></Div> demarked areas of a page, or a paragraph <p></p> or Table Cells) in a way that is similar to the little JavaScript commands that we have used previously to copy text into a Text Box. To do this, we need to give the DIV or table cell or paragraph a unique ID. For instance, the code used in the example above simply inserts the name "ansE" as the ID of the lower right table cell.

<td id="ansE">Reagan</td>

We could do the same thing with any area of the screen located between DIV tags and use any object to trigger the change. The code to set this up might look something like this:

<Div id="answerE">
This text will change if I modify the properties of "answerE".
</Div>

Actually making the change involves some Javascript that looks just a bit more complex than what we did when changing the Text Box contents:

onmouseover="document.getElementById('answerE').innerHTML='Don\'t you dare!'"

Adding in red and green color:

onmouseover="document.getElementById('answerE').innerHTML='<font color=\'#FF0000\'>This is Bob !</font>'" onmouseout="document.getElementById('answerE').innerHTML='<font color=\'#00FF00\'>Did that work?</font>'"

Let's put that in an image tag (We could put these in many other objects as well):

<img src="bob1.jpg" onmouseover="document.getElementById('answerE').innerHTML='<font color=\'#FF0000\'>This is Bob !</font>'" onmouseout="document.getElementById('answerE').innerHTML='<font color=\'#00FF00\'>Did that work?</font>'" width="200" height="290" />

Note that the use of single and double quotation marks needs to be precise and that any single quote or apostrophe used in the text itself must be preceded by an escape character (\).

This text will change if I modify the properties of "answerE".
The preceding sentence will change when you mouseover the photo.

And we could also put the Javascript code into a function in our page head (changeContent) to simplify our web page if we are planning to change the contents of many named objects on the page.

<Script>
function changeContent(id,shtml) {
   if (document.getElementById || document.all) {
      var el = document.getElementById? document.getElementById(id): document.all[id];
      if (el && typeof el.innerHTML != "undefined") el.innerHTML = shtml;
   }
}
</Script>

This makes our source easier to read and to proof. As we have said before, you don't have to understand it to use it. Here it is again, using the function and different colors:

<img src="bob1.jpg"
onmouseover="changeContent('answerE','<font color=\'#AAAA00\'>This is Bob !</font>')"

onmouseout="changeContent('answerE','<font color=\'#FF00FF\'>Did that work?</font>')"
width="100" height="145" />

I repeat: This is only a taste for those who might want to explore this aspect of web page design. A good place to start is to take a couple of simple tricks like the ones on this page and play around with them to see what kinds of different things you can make them do. To learn more, look for tutorials on DHTML, CSS style, and JavaScript.




Return to Syllabus