[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 678
  • Last Modified:

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

I need to be able to put the umlaut-letters in a jacascript ticker. How do i do this?
Algabatz
0
algabatz
Asked:
algabatz
1 Solution
 
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 new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now