Jump to content

Adding space ?????


billy1990

Recommended Posts

Hay guys,

 

I need to make spaces between my questions and possible answers. at the moment what happens is that there is a space between the question and the answers for it but no space between the last set of answers and the following question

 

so for example

 

Question One

A1

A2

A3

Question two

 

A1...

 

here is the code and thanks in advance

 

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HCI-Test Yourself</title>
<script type="text/javascript" src="quiz_functions.js"></script>
<script type="text/javascript" src="quiz_config.js"></script>
<style type="text/css">
<!--
body {
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
background-image:url("images/bg.jpg");
margin: 0;
padding: 0;
color: #000;
vlink:#0000ff;
}

/* ~~ Element/tag selectors ~~ */
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0;	 /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
padding-right: 15px;
padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
}
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
border: none;
}

/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
a:link {
color:#414958;
text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
}
a:visited {
color: #4E5869;
text-decoration: underline;
}
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
text-decoration: none;
}

/* ~~ this container surrounds all other divs giving them their percentage-based width ~~ */
.container {
width: 80%;
max-width: 1260px;/* a max-width may be desirable to keep this layout from getting too wide on a large monitor. This keeps line length more readable. IE6 does not respect this declaration. */
min-width: 780px;/* a min-width may be desirable to keep this layout from getting too narrow. This keeps line length more readable in the side columns. IE6 does not respect this declaration. */
background: #FFF;
margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout. It is not needed if you set the .container's width to 100%. */
}

#iphonepic
{
float:right;
margin:10px;
}

/* ~~ the header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo ~~ */
.header {
background-color: #037DE2;
}

/* ~~ These are the columns for the layout. ~~ 

1) Padding is only placed on the top and/or bottom of the divs. The elements within these divs have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.

2) No margin has been given to the columns since they are all floated. If you must add margin, avoid placing it on the side you're floating toward (for example: a right margin on a div set to float right). Many times, padding can be used instead. For divs where this rule must be broken, you should add a "display:inline" declaration to the div's rule to tame a bug where some versions of Internet Explorer double the margin.

3) Since classes can be used multiple times in a document (and an element can also have multiple classes applied), the columns have been assigned class names instead of IDs. For example, two sidebar divs could be stacked if necessary. These can very easily be changed to IDs if that's your preference, as long as you'll only be using them once per document.

4) If you prefer your nav on the right instead of the left, simply float these columns the opposite direction (all right instead of all left) and they'll render in reverse order. There's no need to move the divs around in the HTML source.

*/
#navbar ul { 
        margin: 0; 
        padding: 5px; 
        list-style-type: none; 
        text-align: center; 
        background-color: #000; 
        } 

#navbar ul li {  
        display: inline; 
        } 

#navbar ul li a { 
        text-decoration: none; 
        padding: .2em 1em; 
        color: #fff; 
        background-color: #000; 
        } 

#navbar ul li a:hover { 
        color: #000; 
        background-color: #fff; 
        } 
.content
{
}

/* ~~ This grouped selector gives the lists in the .content area space ~~ */
.content ul, .content ol { 
padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
}

/* ~~ The navigation list styles (can be removed if you choose to use a premade flyout menu like Spry) ~~ */
ul.nav {
list-style: none; /* this removes the list marker */
border-top: 1px solid #666; /* this creates the top border for the links - all others are placed using a bottom border on the LI */
margin-bottom: 15px; /* this creates the space between the navigation on the content below */
}
ul.nav li {
border-bottom: 1px solid #666; /* this creates the button separation */
}
ul.nav a, ul.nav a:visited { /* grouping these selectors makes sure that your links retain their button look even after being visited */
padding: 5px 5px 5px 15px;
display: block; /* this gives the link block properties causing it to fill the whole LI containing it. This causes the entire area to react to a mouse click. */
text-decoration: none;
background: #8090AB;
color: #000;
}
ul.nav a:hover, ul.nav a:active, ul.nav a:focus { /* this changes the background and text color for both mouse and keyboard navigators */
background: #6F7D94;
color: #FFF;
}

/* ~~The footer ~~ */
.footer {
padding: 10px 0;
background: #06F;
position: relative;
clear: both;
background-color: #0099CC;
}

/* ~~miscellaneous float/clear classes~~ */
.fltrt {  /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the #footer is removed or taken out of the #container */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}

-->
</style><!--[if lte IE 7]>
<style>
.content { margin-right: -1px; } /* this 1px negative margin can be placed on any of the columns in this layout with the same corrective effect. */
ul.nav a { zoom: 1; }  /* the zoom property gives IE the hasLayout trigger it needs to correct extra whiltespace between the links */
</style>
<![endif]--></head>

<body>

<div class="container">
  <div class="header"><!-- end .header --><a href="#"></a><a href="#"><img src="images/logo.jpg" width="250" height="120" alt="UWS Logo" /></a></a><img src="images/banner.jpg" width="540" height="120" alt="banner" /></div>
  <div class="content">
<div id="navbar"> 
  <ul> 
		<li><a href="index.html">Home</a></li> 
        <li><a href="resources.html">Resources</a></li> 
        <li><a href="test_yourself.html">Test Yourself</a></li> 
  </ul> 
</div> 
    <h1>Test Yourself</h1>
    <p><img src="images/question.jpg" id="iphonepic"" alt="question" /></p>
    
<table align="center" border="1"> 
<tr><td> 
<script type="text/javascript"> 
<!--
  renderQuiz();
//-->
</script> 
</td></tr></table> 
<p><div align="center">
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
<p>

</div>
  
  <div class="footer">
    <p>Author: Bilal Abdelwahed<br />
    Student Number: 1705 2027</p>
    <!-- end .footer --></div>
<!-- end .container --></div>
</body>
</html>

 

 

Javascript

/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: James Crooke :: http://www.cj-design.com */

var questions = new Array();
var choices = new Array();
var answers = new Array();
var response = new Array();

// To add more questions, just follow the format below.

questions[0] = "1) JavaScript is ...";
choices[0] = new Array();
choices[0][0] = "the same as Java";
choices[0][1] = "kind of like Java";
choices[0][2] = "different than Java";
choices[0][3] = "ther written part of Java";
answers[0] = choices[0][2];



questions[1] = "2) JavaScript is ...";
choices[1] = new Array();
choices[1][0] = "subjective";
choices[1][1] = "objective";
choices[1][2] = "evil";
choices[1][3] = "object based";
answers[1] = choices[1][3];



questions[2] = "3) To comment out a line in JavaScript ...";
choices[2] = new Array();
choices[2][0] = "Precede it with two forward slashes, i.e. '//'";
choices[2][1] = "Precede it with an asterisk and a forward slash, i.e. '*/'";
choices[2][2] = "Precede it with an asterisk, i.e. '*'";
choices[2][3] = "Precede it with a forward slash and an asterisk, i.e. '/*'";
answers[2] = choices[2][0];

questions[3] = "4) JavaScript can only run on Windows";
choices[3] = new Array();
choices[3][0] = "True";
choices[3][1] = "False";
answers[3] = choices[3][1];

questions[4] = "5) Semicolons are optional at the end of a JavaScript statement.";
choices[4] = new Array();
choices[4][0] = "True";
choices[4][1] = "False";
answers[4] = choices[4][0];

questions[5] = "6) The four basic data types are:";
choices[5] = new Array();
choices[5][0] = "strings, numbers, BooBoos, and nulls";
choices[5][1] = "strings, text, Booleans, and nulls";
choices[5][2] = "strings, numbers, Booleans, and nulls";
choices[5][3] = "strings, numbers, Booleans, and zeros";
answers[5] = choices[5][2];

// response for getting 100%
response[0] = "Excellent, top marks!";
// response for getting 90% or more
response[1] = "Excellent, try again to get 100%!"
// response for getting 70% or more
response[2] = "Well done, that is a good score, can you do better?";
// response for getting over 50%
response[3] = "Nice one, you got more than half of the questions right, can you do better?";
// response for getting 40% or more
response[4] = "You got some questions right, you can do better!";
// response for getting 20% or more
response[5] = "You didn't do too well, why not try again!?";
// response for getting 10% or more
response[6] = "That was pretty poor!  Try again to improve!";
// response for getting 9% or less
response[7] = "Oh dear, I think you need to go back to school (or try again)!";

Link to comment
Share on other sites

You've blatantly just downloaded this with little to no knowledge of JavaScript/HTML/CSS, and now you want us to customise it for you. If you have a specific problem and can point out the relevant code, I'd be happy to help. I'm/we're not just going to do it for you though...

Link to comment
Share on other sites

I have only because my assignment allows me to as it is primarily concerned with the aesthetics and interactivity of what is designed. I would code it myself if that was the requirement but its not here and so it works best for me to cut corners and save myself time. I have however acknowledged the source.

 

Also I know quite a bit about both HTML and CSS however again, I saved myself coding and used dreamweaver because its faster and gets the same job done.

 

 

Link to comment
Share on other sites

"All request for code to be written for you should be posted under the freelance section. No exceptions"

 

I'm not asking for code to be written I'm asking how can I do a certain thing.I provided the code because it works easiest in the end, people always ask for code from what I have seen as it helps them visually see what's going on.

 

"Users will not post their homework questions expecting to get their homework coded for them. If you have a question about part of the assignment that you do not understand, please post asking for an explanation rather than the code."

 

Again, it usually comes down to asking for code so I posted code to save myself, and whoever choses to help me, time. I am not asking anyone to do my work for me, I'm asking for help with one issue and taht will be the end of it. I've tried to figure out the issue myself for almost 2 hours and I'v run multiple searches and run into dead ends, its probably my poor searching skills or something but I've only resorted to asking after having put in a number of hours myself.

 

 

Link to comment
Share on other sites

Your posts are full of contradiction.

 

I'm not asking for code to be written I'm asking how can I do a certain thing.I provided the code because it works easiest in the end, people always ask for code from what I have seen as it helps them visually see what's going on.

 

Re-read your first post. You tell us what you want doing, give us your existing code, and then say thanks. How is that not a request for us to do it? Even if that wasn't the intention, you still unintentionally gave off that impression.

 

I would code it myself if that was the requirement but its not here and so it works best for me to cut corners and save myself time. I have however acknowledged the source.
I am not asking anyone to do my work for me, I'm asking for help with one issue and taht will be the end of it. I've tried to figure out the issue myself for almost 2 hours and I'v run multiple searches and run into dead ends

 

You originally say you want to save yourself time and cut corners, and that you've only acknowledged the source code. Now it's 2 hours endlessly trying to figure it out? As I said full of contradiction. If you post the relevant code I'm sure we can sort it out quickly, but why should I spend time picking through the code to find the root of your problem, so that I can save you the time? It's a perfectly fair point.

Link to comment
Share on other sites

The las time I posted here I did the same thing. put the code there and asked for help with it no one changed the code rather they suggested ways to fix it. If there is specific code that can help here then that would be good, if its a matter of saying use this here and think about changing that, that would also be fine. If I did come off as you describe however then in future I will take that into consideration and post in a more appropriate manner however your going to have to forgive me this time as I said I'v been trying to solve it myself but to no avail.

 

Think about what I said, I used stock code to help me cut corners but using the stock code is one thing and trying to get the aesthetics of it right is another. All I'm asking is how do I add space between one thing and another nothing else. I'm using stock code, but this issue seems to have come with it and it is this issue I'v been trying to figure out. No contradictions at all. 

 

 

Link to comment
Share on other sites

also with regards to giving you the relevant code I honestly thought I did. I don't have an extensive knowledge about JS, not yet anyway, I thought the most relevant things would be either the css or that page of JS. There is another JS page which I didn't post because I didn't see it as relevant

Link to comment
Share on other sites

also with regards to giving you the relevant code I honestly thought I did. I don't have an extensive knowledge about JS, not yet anyway, I thought the most relevant things would be either the css or that page of JS. There is another JS page which I didn't post because I didn't see it as relevant

 

You didn't just provide the CSS and JS though. You gave us a couple hundred lines of random HTML to scan through, with no explanation as to what's where and full of lines like:

 

<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>

 

Anyway it doesn't matter now. I forgive you.. You need to post the renderQuiz() function though (check line 182 of your HTML) so we know how the CSS styles are applied to the HTML.

Link to comment
Share on other sites

Thanks heaps MrAdam and ignace

 

here is the code for the renderquiz() function. I've only copied the actual function rather then the page it exist on :)

 

var useranswers = new Array();
var answered = 0;

function renderQuiz() {
  for(i=0;i<questions.length;i++) {
    document.writeln('<p class="question">' + questions[i] + ' <span id="result_' + i + '"><img src="blank.gif" style="border:0" alt="" /></span></p>');
    for(j=0;j<choices[i].length;j++) {
      document.writeln('<input type="radio" name="answer_' + i + '" value="' + choices[i][j] + '" id="answer_' + i + '_' + j + '" class="question_' + i + '" onclick="submitAnswer(' + i + ', this, \'question_' + i + '\', \'label_' + i + '_' + j + '\')" /><label id="label_' + i + '_' + j + '" for="answer_' + i + '_' + j + '"> ' + choices[i][j] + '</label><br />');
    }
  }
  document.writeln('<p><input type="submit" value="Show Score" onclick="showScore()" /> <input type="submit" value="Reset Quiz" onclick="resetQuiz(true)" /></p><p style="display:none"><img src="correct.gif" style="border:0" alt="Correct!" /><img src="incorrect.gif" style="border:0" alt="Incorrect!" /></p>');
}

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.