Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #8016

Re: basic Q on enclosing curly quotation/quot characters into strings

From Denis McMahon <denismfmcmahon@gmail.com>
Subject Re: basic Q on enclosing curly quotation/quot characters into strings
Newsgroups comp.lang.javascript
References <3ce3cfc5-e4fb-45b9-8e6f-328ee1f388e7@m19g2000vbm.googlegroups.com> <j91gj2$f40$1@dont-email.me> <223d9ce4-6c87-4290-bd21-7e538245b443@r7g2000vbg.googlegroups.com>
Date 2011-11-04 21:40 +0000
Message-ID <4eb45bc7$0$28523$a8266bb1@newsreader.readnews.com> (permalink)
Organization readnews.com - News for Geeks and ISPs

Show all headers | View raw


On Fri, 04 Nov 2011 13:42:04 -0700, Timothy Gill wrote:

>    word="this";
>    labels[0] = "The 5th word in " + word.italics() + " sentence should
> appear in italics.";

> Anyway, thanks again.

What you do is create embedded html markup in the string, eg labels[0] is 
stored as "The 5th word in <i>this</i> sentence should appear in italics."

Whether it displays the stored text or the html interpretation of it 
depends on the context in which the string is being used.

If you use labels[0] in an alert box, or assign it to the value of a 
button, for example, you will see the markup.

However, if you assign it as the innerHTML of a <td>, <li>, <hN>, <p> etc 
element, it will display the word "this" italicised.

eg see http://www.sined.co.uk/tmp/italics.htm and click on "a button"

Rgds

Denis McMahon


Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

basic Q on enclosing curly quotation/quot characters into strings Tim <timothygill07040@gmail.com> - 2011-11-04 12:41 -0700
  Re: basic Q on enclosing curly quotation/quot characters into strings "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-11-04 22:05 +0200
    Re: basic Q on enclosing curly quotation/quot characters into strings Timothy Gill <setsee@gmail.com> - 2011-11-04 13:42 -0700
      Re: basic Q on enclosing curly quotation/quot characters into strings Denis McMahon <denismfmcmahon@gmail.com> - 2011-11-04 21:40 +0000
      Re: basic Q on enclosing curly quotation/quot characters into strings "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-11-04 23:50 +0200

csiph-web