Integrating Technology in the Foreign Language Classroom

  
Jean LeLoup & Bob Ponterio 
SUNY Cortland 
© 2017
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 Kompozer


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.


2. Tooltips can also be used for glossing a text without creating specialized pop-up windows. When you place your mouse over the link below, a tooltip will open and display the gloss. The tooltip 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 adding 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 using a tool-tip.

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

You can edit title properties in the HTML Tags view in Kompozer.

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! In this case, the SPAN tag could be safer.


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. You just have to use the HTML code that inserts the object you want.

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

Note that although we used the built-in Alert pop-up as an example just to let you know it exists, it is very ugly, not user friendly, and should generally be avoided.

 


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 using Dynamic HTML (DHTML). These can create Layers or DIVs (Boxes) 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.

 

Here is an example of using DHTML with buttons.

The first US president was:

Washington.  
Jefferson.  
Lincoln.  
Roosevelt.
Donald Trump.

DHTML is beyond the scope of this course, so this little taste is purely optional. DHTML is called "dynamic" because it can dynamically change the contents of a web page while you are looking at it. If you wish to explore these kinds of popup windows, google 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> or <Span></Span> defined 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, SPAN 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">Donald Trump.</td>

We could do the same thing with any area of the screen located between <DIV> </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 the page element with the ID = "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!'"

We used onmouseout in the same way to change it back.

 

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 with a different image.

<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'll repeat that 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.

You can set up your own DIV to display feedback without using something that you have bought or downloaded. Here is a sample French fill-in the blank activity that uses these techniques.




Return to Syllabus