...

View Full Version : html formatting in javascript



bvdman89
09-04-2008, 11:55 PM
I have a variable:
words[1] = "hello sam"

Is there a way to make it respect html formatting such as..
words[1] = "<b>hello</b><br><i>sam</i>"

yeal352
09-05-2008, 07:27 AM
I have a variable:
words[1] = "hello sam"

Is there a way to make it respect html formatting such as..
words[1] = "<b>hello</b><br><i>sam</i>"



like this :

words[1].split(' ');
you can use "split" to split the string to an array,then ,you know

rhinodog8
09-05-2008, 08:57 AM
you could use
document.write="<b>hello</b><br><i>sam</i>"

and put that into a function.

bvdman89
09-05-2008, 06:48 PM
Thank you for the replies.

I'm very new to javascript. Can you describe "split" more.

And for document.write, where would I place this?

yeal352
09-08-2008, 02:59 AM
split is a function of "String" you can split a string with the function ...
detail usage you may find in google...so does "document write"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum