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

I need to be able to put the umlaut-letters in a jacascript ticker. How do i do this?
Algabatz
LVL 1
algabatzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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


0
algabatzAuthor Commented:
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
algabatzAuthor Commented:
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
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

rsfCommented:
For some good and cheap applets check out http://www.opencube.com

0
Christian_WenzCommented:
have you tried escape/unescape?
0
algabatzAuthor Commented:
I don't get it... what do you mean?
0
LevinCommented:
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
algabatzAuthor Commented:
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
Holger101497Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.