/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] problem with external css style sheet

Hi

I am having a little problem with my external style sheet. I am quite sure I have written it correctly, but I am having trouble with the paragraph styles in my external css style sheet. My code for my style sheet is shown below:

[CODE]
body {background-color:b0c4de;
color:#000000;
font-family: Arial, sans-serif, Helvetica
}

h1 {color:#000099;
font-style:bold;
font-family:Arial
}

p.1 {font-style:normal;}

p.2 {font-style:oblique;}
[/CODE]

I have inserted the link into my html file linking it to the external style sheet, but need to know why the paragraphs are not displaying hwo they should. Currently, I have a user who answers 10 questions, then they are displayed on screen (from javascripting), but the problem is they are not showing. I have used the class=”1″, and class=”2″, but it is not displaying and all I get is a blank screen except for the background colour and <h1>. A little example of my code is shown below:

[CODE]
<html>
<head>
<title>Tester</title>
<link rel=”stylesheet” type=”text/css” href=”tstyle.css” />
<script language=”JavaScript”>
var questionOne = prompt(“25+56=”,””);
</script>
</head>
<body>
<h1>Mathematics Quiz</h1>
<script language=”JavaScript”>

if(answer1 == 25+56)
{
document.write(“<p class=”1”><font color=’green’>25+56 = “+questionOne+” You are totally correct!</font></p>”);
}
else
{
document.write(“<p class=”2″><font color=’red’>25+56 = ” +questionOne +” …Oh Dear!, The correct Answer is ” + (25+56) +”</font></p>”);
}

</script>
</body>
</html>
[/CODE]

Any ideas on why the paragraphs are not displaying when the user has finished the quiz and the answers are displayed?

Thanks if you can help.

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@FangMar 08.2009 — The cass names are invalid: http://www.w3.org/TR/html4/types.html#type-id
Copy linkTweet thisAlerts:
@CharlesMar 08.2009 — Your problem was with your JavaScript and you should not be using the FONT element.&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;title&gt;Tester&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" href="tstyle.css"&gt;
&lt;script language="JavaScript"&gt;
questionOne = prompt("25+56=","");
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Mathematics Quiz&lt;/h1&gt;
&lt;script type="text/javascript"&gt;

<i> </i> if (questionOne == 25+56) {
<i> </i> document.write ('&lt;p class="one"&gt;25+56 = ', questionOne, ' You are totally correct!&lt;/p&gt;');
<i> </i> } else {
<i> </i> document.write ('&lt;p class="two"&gt;25+56 = ', questionOne, ' ...Oh Dear!, The correct Answer is ', 25 + 56, '&lt;/p&gt;');
<i> </i> }

<i> </i> &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@rushhour2authorMar 08.2009 — sorry. post deleted.
Copy linkTweet thisAlerts:
@CharlesMar 08.2009 — Thanks it works! Can I ask you charles to please delete your post or edit it so there is no code, it is quite important that you do so.

Thanks in advance.[/QUOTE]
Absolutely not. If you have committed academic dishonesty then you'll just have to take what you get. When I was in school one instance of any kind of cheating meant expulsion.
Copy linkTweet thisAlerts:
@rushhour2authorMar 08.2009 — May I say, it wasn't cheating, as I gave you my code to see where my mistakes lie, and to ask for help in how to correct the problem, so the answers actually do display, instead of not showing up at all. I do however, thank you for your help, as it has solved the problem.
×

Success!

Help @rushhour2 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...