Solved

ä in JS (å, ä, ö, ü)

Posted on 1997-09-29
9
624 Views
Last Modified: 2012-05-04
I need to be able to put the umlaut-letters in a jacascript ticker. How do i do this?
Algabatz
0
Comment
Question by:algabatz
9 Comments
 
LVL 3

Expert Comment

by:gwalters
ID: 1270796
Works fine for me, both netscape and iexplore.  Could you post your code and tell what's wrong?


0
 
LVL 1

Author Comment

by:algabatz
ID: 1270797
Here it is, courtesy Kollegov:
 <html>
                                         <head>
                                         <script>
                                         messages = new Array()
                                         messages[0]="&aring;&auml;&ouml;"
                                         messages[1]="Calle har mjäll"
                                         messages[2]="Linda skriver böcker"
                                         messages[3]="Sture hoppar"

                                         var n=0
                                         var nmessages=3
                                         function scroll()
                                         {
                                         document.kaka.kaka.value=messages[n];
                                         n++;
                                         if(n>nmessages) n=0;
                                             
                                         setTimeout("scroll()",2000)
                                         }


                                         </script>


                                         </head>

                                         <body onLoad="scroll()">
                                         <FORM NAME=kaka>
                                         <input name=kaka type=text size=40>
                                         </form>

                                            </body>
                                         </html> c
0
 
LVL 1

Author Comment

by:algabatz
ID: 1270798
BTW:
i would actually prefer an applet that works in the same way, where i can change the text , colour of the text and the colour of the background with params. I have found free applets but they all scroll. This is the closest to what i want, though.
Algabatz
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Expert Comment

by:rsf
ID: 1270799
For some good and cheap applets check out http://www.opencube.com

0
 
LVL 5

Expert Comment

by:Christian_Wenz
ID: 1270800
have you tried escape/unescape?
0
 
LVL 1

Author Comment

by:algabatz
ID: 1270801
I don't get it... what do you mean?
0
 

Expert Comment

by:Levin
ID: 1270802
escape/unescape is a way to (de)code strange/illegal characters into codes (prefixed by a %). I don't know how that could help you though.

BTW
Try using real åäös instead. It'll work on most platforms.
(Who cares about mac-users anyway???)
0
 
LVL 1

Author Comment

by:algabatz
ID: 1270803
Well, you know us Mac-users secretly rule the world...  
I have the same problem on a unix-based CGI though, (CGIEMAIL), it reads from a template but ignores all åäö:s (getting strange signs instead)
0
 
LVL 6

Accepted Solution

by:
Holger101497 earned 50 total points
ID: 1270804
Well, this is indeed strange. This is the first time I have this problem; the JavaScript quotes seem to stop Netscape from interpreting the &specialchars;  
I did not find a way to stop it from doing so.
I did, however, find a way to make your ticker work. This is actually a workaround that works fine for this situation, because Netscape obviously DOES transform the &uml; in form-values.
Try this:

<html>
 <head>
  <script>
    function scroll()
    {
     with (document.kaka) {
          // this is a better way of rotating:
          // shorter and "auto-detects" the length
          // also saves one variable and eliminates bugs
          // resulting from wrong "nmessages"-value
          // works for any array, e.g. messages.length
      kaka.value=tickertxt[n++].value;
      n %= tickertxt.length; // %= is n=n MOD length
     }
     setTimeout("scroll()",2000)
    }
</script>


</head>
<body onLoad="n=0;scroll()">
<FORM NAME=kaka>
<input name=kaka type=text size=40>
     // ANYthing you want in these fields
<input type=hidden name=tickertxt value="&aring;&auml;&ouml;&copy;&reg;&frac34;">
<input type=hidden name=tickertxt value="Calle har mj&auml;ll">
<input type=hidden name=tickertxt value="Linda skriver b&ouml;cker">
<input type=hidden name=tickertxt value="Sture hoppar">
</form>
</body>
</html>

Good luck!

P.S.: If you are still looking for a different JS-solution, chekc this out, works for me (strangely enough), might offer different possibilities:
<form>
  <input type=text name=txt value="&auml;">
  <input type=button value=" add " onClick="txt.value+='H&auml;gar'"> //DOES replace it here!!!
  <input type=button value=" echo " onClick="alert(txt.value)">
  <input type=button value=" rotate " onClick="txt.value=txt.value.substring(1,999)+txt.value.charAt(0)">
</form>

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hide cell in a table 2 27
innerHTML 7 35
how can i make 2 columns? 4 41
Javascript 2 24
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question