This is a discussion on "Problem with ["] and ['] in javascript string" within the JavaScript Forum section. This forum, and the thread "Problem with ["] and ['] in javascript string are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Problem with ["] and ['] in javascript string
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Hi all,
I encounter a problem in dealing with " and ' in javascripts. The case is that I have to create an image tag with onclick trigger another javascript function which take in param as below: document.<sth>.innerHTML = "<img scr='img/somthing.gif' onclick='imageClicked('sample1')'"; But it failed to function even when I tried to use " and VAR in splitting the variable... really need help from yrs... thanks much !! |
|
|
|
||||
|
Re: Problem with ["] and ['] in javascript string
You have to escape some of the quotes. I'd do it like this:
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
|
|||
|
Re: Problem with ["] and ['] in javascript string
Thanks c010depunkk!! It's solved
|
|
||||
|
Re: Problem with ["] and ['] in javascript string
no problem....
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
![]() |
| Tags |
| innerhtml, string |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Decoding a string in Javascript | omega113 | JavaScript Forum | 1 | Jun 12th, 2008 16:07 |
| Javascript problem - unterminated string | jitumandalia | JavaScript Forum | 2 | Feb 14th, 2008 07:43 |
| Appending "..." after so many pixels in a string | RooZ | Web Page Design | 7 | Jan 24th, 2008 17:00 |
| [SOLVED] Javascript Printer-Friendly Page "Creator" | Stuart | JavaScript Forum | 33 | Oct 13th, 2007 13:06 |
| <option value="yes" class="x"> problem in Firefox | mameha1977 | Web Page Design | 1 | Jun 21st, 2006 11:20 |