• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

javascript and html ascii codes

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • 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: 9674
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this

 
Ritu varada
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • 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
  • 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(,).
 
Eliminate 95% of the weeds in your lawn by mowing 3 inches or higher. Then plant tiny ads:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic