• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javascript and html ascii codes

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to use a javascript based scroll. The scroll's content comes from a javascript array.


To be consistent with the rest of html generation, we wanted to use ascii html for all the special characters but the browser ignored double quotes code which specifies the css class, which meant that the text did not change color as the css class specified.
I am a novice to javascript.So, I am not able to figure out why the browser executed the html ascii code (which puts a comma) within
the array string but not the one that specifies the css class.

It have deliberately put space between & # 34 so that the browser does not interpret this.
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this

 
Ritu varada
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ankit. It displays okay if I have 'color-red' but if I do

pausecontent[2]="<div class= & # 39color-red & # 39>

Trying out javascript quotes today , 08/27/2009

</div>"

It still does not convert the & #39 to single quotes whereas it converts & # 44 to be comma.
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ritu varada wrote:Thanks Ankit. It displays okay if I have 'color-red' but if I do

pausecontent[2]="<div class= & # 39color-red & # 39>

Trying out javascript quotes today , 08/27/2009

</div>"

It still does not convert the & #39 to single quotes whereas it converts & # 44 to be comma.



Webbrower treat &#39; and the single quote(') differently and they are not the same. In the same sense, &#44; is different from a comma(,). It causes syntax error if you use it inside a javascript object to replace the normal comma(,).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic