Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScipt Bold Statement Wanted

Status
Not open for further replies.

smmurph

IS-IT--Management
Jul 8, 2005
10
US
Here is the script I am trying to update:

if (events[0] == "Y") {
if ((events[2] == day) && (events[1] == month)) {
theevent += "Events of: \n" + month +'/'+ day +'/'+ year + '\n';

***theevent += events[6] + '\n';***

theevent += 'Start Time: ' + events[4] + '\n';
theevent += 'Ending Time: ' + events[5] + '\n';
theevent += 'Description: ' + events[7] + '\n';
theevent += '\n -------------- \n\n';

document.forms.eventform.eventlist.value = theevent;
}

The line in question is the one that is separated in the middle with asterisks (these are not part of the code. This code pull from an Array in a .js file and places it in a text box. I want what is picked up by this line of code to be bold, but I have tried .bold(), and have tried the <b></b> and neither one work. Both of these attempts shows the <b></b> around the text that is pulled from the Array.

Any ideas how I can apply bold formatting to the text that is pulled from the array?

(I also tried to format other text in thebox, and it won't allow me to do any formatting at all)

plase help! :)

Smmurph
 
Try adding this line to your code
Code:
document.forms.eventform.eventlist.style.fontWeight = 'bold';
or
Code:
<input type="text" style="font-weight:bold;" name="eventlist" id="eventlist">
If you use cascading style sheets, you can set the characteristics for this to pretty much anything you want, too.

Lee
 
Trollacious,

I apologize, I wasn't completely clear. I only want to bold the text on that one line not for the entire text box. Is there a way to isolate that one line and bold it?

Thanks,
Smmurph
 
Text input or text area? I don't think you can mix and match like that inside any form inputs.

Lee
 
This may be why I am having such a hard time getting it to work. :)

Thanks,
smmurph
 
You have this as your last statement in javascript:

Code:
document.forms.eventform.[!]eventlist[/!].value = theevent;

I see you have text box written, and I see that trollacious asked you what type (Text input or text area). But I still see no definitive answer.

What kind of object is eventlist???

Is it an <input> or <textarea>??


[small]"There's an old saying in Tennessee — I know it's in Texas, probably in Tennessee — that says, fool me once, shame on — shame on you. Fool me — you can't get fooled again." - George W. Bush[/small]
<.
 
I'd guess that since inputs and textareas don't support creating containers inside them, you can't apply a style to part of them. They are text, afterall.

Lee
 
After looking into this, the only way that I found that this can be done is to create a <div> and make it look like a textarea, and put the formatted content into the <div> with the innerHTML command. If you are interested in what I just posted and don't understand what I said, feel free to ask.

[small]"There's an old saying in Tennessee — I know it's in Texas, probably in Tennessee — that says, fool me once, shame on — shame on you. Fool me — you can't get fooled again." - George W. Bush[/small]
<.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top