Software, your way.
burger menu icon
WillMaster

WillMaster > LibraryGenerators and Converters

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

Quick HTML Code for Common Accented Letters

The English language has few words with accented letters compared to some languages. Thus, suddenly needing to type an accented letter can interrupt a productive writing stride.

Some time ago, I found a way to make it less interruptive.

There is a tool on my personal portal page — type in a letter and it responds with both the accented versions of the letter and the HTML code to create them with.

The accented letter or the HTML code can be copied and pasted, allowing a quick resumption of writing stride.

That tool was updated for presentation and so it can be published on other web sites as an optional SAAS application.

It responds with accented letters and code when one of these letters are typed into it: A, a, C, c, E, e, I, i, N, n, O, o, U, u, Y, and y.

Here is the tool, live — type in one of the letters from the list above:

When you use the tool, copy the HTML code for your web page or the accented character for your article and you're good to go.

The Accented-Letter Tool for Yourself

To make the tool available for yourself, any of these 3 methods can be adopted so you can use the tool quickly and get back to your writing.

  1. Bookmark this web page or link to it on your personal portal page.

    — or —

  2. Paste this line of JavaScript into your web page to publish the tool. When published, the tool will have a compliments‑of link.

    — or —

  3. Copy and paste the software source code into your web page. You'll find the code further below in this article.

Installing the Accented-Letter Tool Software

To install the tool and its JavaScript on your web page (the third of the three options above), you'll need two chunks of code.

The first chunk:

This is the HTML code, the part that publishes the visible tool.

It's copy and paste. Pop it into your web page where you want the tool to be published.

<div style="border:3px solid #ccc; border-radius:6px; padding:6px 0; display:table;">
<div style="text-align:center; padding:0 6px;"><input type="text" style="text-align:center; width:2em; border:1px solid #999;" placeholder="A" onkeyup="GetAccentedLetters(this)"></div>
<div id="accent-results-container"></div>
</div>

The style may be changed, of course.

The second chunk:

This is the JavaScript, the part that gives the tool it's instant response when a letter is typed into it.

This also is copy and paste. Pop it into the same web page that contains the tool HTML code. It can be pasted into anyplace on the web page where JavaScript can run. Immediately above the closing </body> tag generally is a good place.

<script type="text/javascript">
function GetAccentedLetters(d)
{
/*
Present Accented Letters
Version 2.0 at October 26, 2019 for operational improvements.
Version 1.0 was January 24, 2010
Will Bontrager Software LLC
*/
   var divstyle = '<div style="text-align:right; margin-top:6px; padding:9px 6px 0 6px; border-top:1px solid #ccc;">';
   var divend = '</div>';
   var instructions = "Type one of these: A a C c E e I i N n O o U u Y y";
   var template = '<span style="margin-left:6px; margin-right:6px;">[[INFO]]</span>';
   var letter = d.value;
   d.placeholder = "";
   d.value = "";
   var codes = "";
   if( letter.match(/^\w$/) )
   {
      switch(letter)
      {
         case "A" : codes = divstyle + "&amp;Agrave; = <span style='font-size:120%;'>&Agrave;</span>" + divend + 
                            divstyle + "&amp;Aacute; = <span style='font-size:120%;'>&Aacute;</span>" + divend + 
                            divstyle + "&amp;Acirc;  = <span style='font-size:120%;'>&Acirc;</span>"  + divend + 
                            divstyle + "&amp;Auml;   = <span style='font-size:120%;'>&Auml;</span>"   + divend + 
                            divstyle + "&amp;Atilde; = <span style='font-size:120%;'>&Atilde;</span>" + divend +
                            divstyle + "&amp;Aring;  = <span style='font-size:120%;'>&Aring;</span>"  + divend;
                    break;
         case "a" : codes = divstyle + "&amp;agrave; = <span style='font-size:120%;'>&agrave;</span>" + divend + 
                            divstyle + "&amp;aacute; = <span style='font-size:120%;'>&aacute;</span>" + divend + 
                            divstyle + "&amp;acirc;  = <span style='font-size:120%;'>&acirc;</span>"  + divend + 
                            divstyle + "&amp;auml;   = <span style='font-size:120%;'>&auml;</span>"   + divend + 
                            divstyle + "&amp;atilde; = <span style='font-size:120%;'>&atilde;</span>" + divend +
                            divstyle + "&amp;aring;  = <span style='font-size:120%;'>&aring;</span>"  + divend;
                    break;
         case "C" : codes = divstyle + "&amp;Ccedil; = <span style='font-size:120%;'>&Ccedil;</span>" + divend;
                    break;
         case "c" : codes = divstyle + "&amp;ccedil; = <span style='font-size:120%;'>&ccedil;</span>" + divend;
                    break;
         case "E" : codes = divstyle + "&amp;Egrave; = <span style='font-size:120%;'>&Egrave;</span>" + divend + 
                            divstyle + "&amp;Eacute; = <span style='font-size:120%;'>&Eacute;</span>" + divend + 
                            divstyle + "&amp;Ecirc;  = <span style='font-size:120%;'>&Ecirc;</span>"  + divend + 
                            divstyle + "&amp;Euml;   = <span style='font-size:120%;'>&Euml;</span>"   + divend;
                    break;
         case "e" : codes = divstyle + "&amp;egrave; = <span style='font-size:120%;'>&egrave;</span>" + divend + 
                            divstyle + "&amp;eacute; = <span style='font-size:120%;'>&eacute;</span>" + divend + 
                            divstyle + "&amp;ecirc;  = <span style='font-size:120%;'>&ecirc;</span>"  + divend + 
                            divstyle + "&amp;euml;   = <span style='font-size:120%;'>&euml;</span>"   + divend;
                    break;
         case "I" : codes = divstyle + "&amp;Igrave; = <span style='font-size:120%;'>&Igrave;</span>" + divend + 
                            divstyle + "&amp;Iacute; = <span style='font-size:120%;'>&Iacute;</span>" + divend + 
                            divstyle + "&amp;Icirc;  = <span style='font-size:120%;'>&Icirc;</span>"  + divend + 
                            divstyle + "&amp;Iuml;   = <span style='font-size:120%;'>&Iuml;</span>"   + divend;
                    break;
         case "i" : codes = divstyle + "&amp;igrave; = <span style='font-size:120%;'>&igrave;</span>" + divend + 
                            divstyle + "&amp;iacute; = <span style='font-size:120%;'>&iacute;</span>" + divend + 
                            divstyle + "&amp;icirc;  = <span style='font-size:120%;'>&icirc;</span>"  + divend + 
                            divstyle + "&amp;iuml;   = <span style='font-size:120%;'>&iuml;</span>"   + divend;
                    break;
         case "N" : codes = divstyle + "&amp;Ntilde; = <span style='font-size:120%;'>&Ntilde;</span>" + divend;
                    break;
         case "n" : codes = divstyle + "&amp;ntilde; = <span style='font-size:120%;'>&ntilde;</span>" + divend;
                    break;
         case "O" : codes = divstyle + "&amp;Ograve; = <span style='font-size:120%;'>&Ograve;</span>" + divend + 
                            divstyle + "&amp;Oacute; = <span style='font-size:120%;'>&Oacute;</span>" + divend + 
                            divstyle + "&amp;Ocirc;  = <span style='font-size:120%;'>&Ocirc;</span>"  + divend + 
                            divstyle + "&amp;Ouml;   = <span style='font-size:120%;'>&Ouml;</span>"   + divend + 
                            divstyle + "&amp;Otilde; = <span style='font-size:120%;'>&Otilde;</span>" + divend +
                            divstyle + "&amp;Oslash; = <span style='font-size:120%;'>&Oslash;</span>" + divend;
                    break;
         case "o" : codes = divstyle + "&amp;ograve; = <span style='font-size:120%;'>&ograve;</span>" + divend + 
                            divstyle + "&amp;oacute; = <span style='font-size:120%;'>&oacute;</span>" + divend + 
                            divstyle + "&amp;ocirc;  = <span style='font-size:120%;'>&ocirc;</span>"  + divend + 
                            divstyle + "&amp;ouml;   = <span style='font-size:120%;'>&ouml;</span>"   + divend + 
                            divstyle + "&amp;otilde; = <span style='font-size:120%;'>&otilde;</span>" + divend +
                            divstyle + "&amp;oslash; = <span style='font-size:120%;'>&oslash;</span>" + divend;
                    break;
         case "U" : codes = divstyle + "&amp;Ugrave; = <span style='font-size:120%;'>&Ugrave;</span>" + divend + 
                            divstyle + "&amp;Uacute; = <span style='font-size:120%;'>&Uacute;</span>" + divend + 
                            divstyle + "&amp;Ucirc;  = <span style='font-size:120%;'>&Ucirc;</span>"  + divend + 
                            divstyle + "&amp;Uuml;   = <span style='font-size:120%;'>&Uuml;</span>"   + divend;
                    break;
         case "u" : codes = divstyle + "&amp;ugrave; = <span style='font-size:120%;'>&ugrave;</span>" + divend + 
                            divstyle + "&amp;uacute; = <span style='font-size:120%;'>&uacute;</span>" + divend + 
                            divstyle + "&amp;ucirc;  = <span style='font-size:120%;'>&ucirc;</span>"  + divend + 
                            divstyle + "&amp;uuml;   = <span style='font-size:120%;'>&uuml;</span>"   + divend;
                    break;
         case "Y" : codes = divstyle + "&amp;Yacute; = <span style='font-size:120%;'>&Yacute;</span>" + divend + 
                            divstyle + "&amp;Yuml;   = <span style='font-size:120%;'>&Yuml;</span>"   + divend;
                    break;
         case "y" : codes = divstyle + "&amp;yacute; = <span style='font-size:120%;'>&yacute;</span>" + divend + 
                            divstyle + "&amp;yuml;   = <span style='font-size:120%;'>&yuml;</span>"   + divend;
                    break;
         default  : codes = divstyle + instructions + divend;
      }
   }
   if( codes.length ) { document.getElementById("accent-results-container").innerHTML = codes; }
}
</script>

When those two chunks are pasted into your web page source code, you should be good to go.

The accented-letter tool is designed to be easy and quick. The implementation, too — with three options.

(This article first appeared with an issue of the Possibilities newsletter.)

Will Bontrager

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2024 Will Bontrager Software LLC