Solved

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

Posted on 1997-09-29
9
644 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…
Suggested Courses

623 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