Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: How to change font colour and style


Message #1 by "Harjit Singh Grewal" <hsgrewal@g...> on Thu, 23 Nov 2000 22:03:27 +0530
This is a multi-part message in MIME format.



------=_NextPart_000_000D_01C05599.351E2860

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



  I'm trying to make a page where a user selects a font style and colour 



of the text  and as soon as he changes the color or style the text on 

that page enetered by him in the textarea changes accordingly.

  If you can solve my problem it will be really nice of you. Thanx in 

advance.

  Harjit






Message #2 by "StephenB" <stephenb@w...> on Thu, 23 Nov 2000 16:58:27 -0000
There are two possible approaches here.



1. Use client side javascript and keep the changes local to the client, the

changes would at least be immediate.



2.  You need to keep a record of the changes the client made.  You could use

cookies or a database server side.  Obviously you would need then to submit

and refresh the page with each change.



You may need a combination of all of the above depending on your

requirements.



Stephen



"Harjit Singh Grewal" <hsgrewal@g...> wrote in message

news:21067@a..._web_howto...

>

> This is a multi-part message in MIME format.

>

> ------=_NextPart_000_000D_01C05599.351E2860

> Content-Type: text/plain;

> charset="iso-8859-1"

> Content-Transfer-Encoding: quoted-printable

>

>   I'm trying to make a page where a user selects a font style and colour 

>

> of the text  and as soon as he changes the color or style the text on 

> that page enetered by him in the textarea changes accordingly.

>   If you can solve my problem it will be really nice of you. Thanx in 

> advance.

>   Harjit

>

> ------=_NextPart_000_000D_01C05599.351E2860

> Content-Type: text/html;

> charset="iso-8859-1"

> Content-Transfer-Encoding: quoted-printable

>

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

> <HTML><HEAD>

> <META content=3D"text/html; charset=3Diso-8859-1" 

> http-equiv=3DContent-Type>

> <META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>

> <STYLE></STYLE>

> </HEAD>

> <BODY bgColor=3D#ffffff>

> <BLOCKQUOTE

> style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 

> 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">

>   <DIV><FONT face=3DArial size=3D2>I'm trying to make a page where a 

> user selects a

>   font style and colour of the text  and as soon as he changes the 

> color or

>   style the text on that page enetered by him in the textarea changes

>   accordingly. </FONT></DIV>

>   <DIV><FONT face=3DArial size=3D2>If you can solve my problem it will 

> be really

>   nice of you. Thanx in advance.</FONT></DIV>

>   <DIV><FONT face=3DArial 

> size=3D2>Harjit</FONT></DIV></BLOCKQUOTE></BODY></HTML>

>

> ------=_NextPart_000_000D_01C05599.351E2860--

>

>

>





Message #3 by simon@p... on Thu, 30 Nov 2000 04:13:29 -0000
hi



the only way to do it with javascript is using the all object, which is a

microsoft invention and therefore not supported by any other browsers.



just assign an id (< ... id="textarea" ... >) to the element you want to change the attributes of.



then use the following javascript:

document.all.textarea.style.*attribute*="yellow" //or whatever



some attributes you can change (replace *attribute*)

color: textcolor

backgroundColor: no explanation needed...

font

fontSize

...





hope this helps you and shows you again that ie is the better choice than

netscape.



simon


  Return to Index