Help - Search - Members - Calendar
Full Version: Text appears in bold face when it should not.
HTMLHelp Forums > Web Authoring > Web Site Functionality
Villanesca
I have a site that runs a conditional javascript to detect the date and depending upon the date prints a different message in bold. This works fine.

Immediately following the script completion there follows narrative in html that should be in a normal font. However, it always displays in bold. I suspect this is to do with javascript implementing the bold face.

I cannot put an html tag </b> for there is no <b> tag !

How do I cure the problem?
pandy
You cure it by finding out why the text is bold in the first place. I don't have enough information to tell you that. Could you please post the URL to the page? smile.gif
Villanesca
QUOTE(pandy @ May 8 2009, 02:14 PM) *

You cure it by finding out why the text is bold in the first place. I don't have enough information to tell you that. Could you please post the URL to the page? smile.gif



The script prints the date related message in bold. It is set up to do that.
I believe that to be the problem but am not certain.

the url is www.sins.org.uk - but it is quite respectable, just an unfortunate name!
The home page is the problem page. The conditional statement is the one that states "There are now 6 days left . . "
the html narrative underneath it should be in normal font - not bold.

Many thanks for your response - it is very kind of you.
Christian J
QUOTE(Villanesca @ May 8 2009, 04:21 PM) *

The script prints the date related message in bold. It is set up to do that.
I believe that to be the problem but am not certain.

Seems correct, the script contains:

CODE
document.write("<center><h3>")

but no corresponding closing tags after the IF/ELSE conditions. Try adding

CODE
document.write("<\/center><\/h3>")

before the </script> closing tag.
pandy
QUOTE
The script prints the date related message in bold. It is set up to do that.
I believe that to be the problem but am not certain.


You were right. That's it. The script writes out CENTER and a H3 tags, but it never closes them. H3 will normally be bolded by browsers. Here's the line.

CODE
document.write("<center><h3>")

You should have a semicolon after that BTW.

You need to make the script write the closing tags too. Just put it last. Right before </script>, after the last curly bracket.

CODE
document.write('<\/h3><\/center>');



QUOTE
the url is www.sins.org.uk - but it is quite respectable, just an unfortunate name!


I'm relieved! happy.gif
pandy
ninja.gif

Well, at least you can be pretty sure it's right with two answers! tongue.gif
Villanesca
Yep, two correct answers!
A pretty swift response to my failure!

Many thamks to you both - very much appreciated.
Especially as I had spent hours trying crack it.
Knowledge is everything!

Now I'll correct it on the www.

Thank you again.

Christian J
My answer wasn't right:

QUOTE
document.write("<\/center><\/h3>")


I mixed up the nesting order. sad.gif
Villanesca
It wasn't a problem. As soon as I read the answers I slapped my forehead with realisation over what the problem was. I didn't need to copy either reply - it hit me like a brick.
Helpers like yourselves are worth your weight in gold - just changing someone's thought pattern can be enough to stop a war, never mind a bit of coding!

I am grateful - it's all you need.
Thank you.

pandy
wub.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.