473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

displaying a string that contains ' (quote)

304 100+
hi,

I have a string like this -> what a great 'score'

now when i try to display this in a div through javascript,

iddiv.innerText = str;

then i get an error that ')' is expected...

my only guess is that it encounters the first quote and considers that the end of the string,

so i would like to know as to how i could display the string correctly.

thanks,
gomzi.
Apr 14 '07 #1
5 2988
hi pal

first dont use innerText as firefox does not use it
as for your question
Expand|Select|Wrap|Line Numbers
  1. str='what a great \"score';
  2.  
  3. iddiv=document.getElementById('mydiv')
  4.  
  5. iddiv.innerHTML=str;
  6.  
well HTH
peace
Apr 14 '07 #2
gomzi
304 100+
hi pal

first dont use innerText as firefox does not use it
as for your question
Expand|Select|Wrap|Line Numbers
  1. str='what a great \"score';
  2.  
  3. iddiv=document.getElementById('mydiv')
  4.  
  5. iddiv.innerHTML=str;
  6.  
well HTH
peace
thanks mate..ya.sure..will use innerHTML from now on. was wondering as to why firefox wasnt displaying it.so thanks for that tip.

just tried your solution ..works great!!
Apr 14 '07 #3
gomzi
304 100+
hi pal

first dont use innerText as firefox does not use it
as for your question
Expand|Select|Wrap|Line Numbers
  1. str='what a great \"score';
  2.  
  3. iddiv=document.getElementById('mydiv')
  4.  
  5. iddiv.innerHTML=str;
  6.  
well HTH
peace

Tried it in firefox. the innerHTML solution doesnt help much..firefox is not displaying anything.. in ie and opera it works great..
Apr 14 '07 #4
hmm works for me in IE and FF ?
Apr 14 '07 #5
acoder
16,027 Expert Mod 8TB
Tried it in firefox. the innerHTML solution doesnt help much..firefox is not displaying anything.. in ie and opera it works great..
There must be something else wrong with some other part of your code. For example, are you using document.all anywhere?
Apr 16 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
11
by: prats | last post by:
I want to write a GUI application in PYTHON using QT. This application is supposed to take in Japanese characters. I am using PyQt as the wrapper for using QT from python. I am able to take input...
2
by: donpro | last post by:
Hi, I have a varchar field in a MySQL database that contains a line of text like so: "This is a line if text" The double quotes are included in the database field. I cannot seem to...
7
by: swethasivaram | last post by:
Hello I have a Java-based web application whose interface can be in multiple languages. My requirement is that the javascript alerts that I display should be displayed in the language in which...
3
by: RichT | last post by:
Hi all, I am experiencing some odd behaviour with a DataGridView. The DataGridView is bound to a DataTable, which is populated with data from a csv file. The column Headings appear fine,...
2
by: nicky123 | last post by:
Hi everyone, This is a brief description that I have provided for parsing & displaying an XML document using DOM API. Please feel free to post your own comments & views regarding...
2
by: Garima12 | last post by:
I am writing following code to fetch the data from database, using stored procedure. problem is it is highlighting ByVal and when I mouse over, it is displaying expression expected. Please anyone...
8
by: SMJT | last post by:
Does anyone know why the string contains function always returns true if the token is an empty string? I expected it to return false. "AnyOldText".Contains("") or...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.