The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Using two styles to format text, formatting text
nsuave116
post Mar 22 2009, 01:40 AM
Post #1





Group: Members
Posts: 2
Joined: 22-March 09
Member No.: 8,130



I am trying to find out if/how i can apply two different styles to text. I have radio buttons set up to select the font style(such as arial...) and a textbox to get the user input for a background color. However, it seems after i select arial and go to apply the background color, the first style changes back to normal and accepts the second style which is the background color. How can I get to accept the first, save that and then apply the second with that.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 22 2009, 05:34 AM
Post #2


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



Can you post a link to sample page?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
nsuave116
post Mar 22 2009, 08:21 AM
Post #3





Group: Members
Posts: 2
Joined: 22-March 09
Member No.: 8,130



I have included the sample file with this post. As you can see, i can select for instance Arial but when I enter blue for the background color arial changes back to the regular font and the background is blue. I am somewhat new to web design so you might have to break it down for me to understand.


Attached File(s)
Attached File  test2.html ( 7.18k ) Number of downloads: 385
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Mar 22 2009, 01:48 PM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Your JS changes the value of the class attribute. If you choose a blue backgrount JS will change the HTML like this.

HTML
<form name = "form1" action ="" class="blueBackground">


Then when you choose Georgia as the font, you'll get this.

HTML
<form name = "form1" action ="" class="georgiaTex">


So as the script is written the classes are mutually exclusive and you can't have a font and a color choice at the same time.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 22 2009, 06:41 PM
Post #5


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



You might try combining multiple classes, like

CODE
<form class="georgia blue">

However the current script complicates things by using separate "change" controls for the radio buttons (onclick) and the text field (a button). If you used a single button for changing everything you could reset the classes each time.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 04:03 AM