View Single Post
Old 05-17-2011, 12:05 AM   PM User | #5
mllanapatriciac
New Coder

 
Join Date: May 2011
Posts: 12
Thanks: 7
Thanked 0 Times in 0 Posts
mllanapatriciac is an unknown quantity at this point
Hi! I revised my code and this is what I came up with because this is what my teacher wanted, but my "submit" button won't work:

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><center><h1>JavaScript Quiz</center></h1>

<script language="javascript" type="text/javascript" src="Laveen_Demo.html">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

</script></head>



<body><form name="CSS">

1. What does CSS stand for?

<p>

<input type="radio" name="Q1" >

Creative Style Sheets

<br>

<input type="radio" name="Q1" >

Computer Style Sheets

<br />

<input type="radio" name="Q1" >

Cascading Style Sheets <br />

<input type="radio" name="Q1" />

Creative Color Sheets

<p>

2. Which type of CSS controls an entire site from one file attribute?

<p>

<input type="radio" name="Q2" >

Inline

+<br>

<input type="radio" name="Q2" >

External <br />

<input type="radio" name="Q2" >

Embedded

<br />

<br />

3. Which type of CSS adds individual html tags in a page by using the "style" attribute?

<p>

<input type="radio" name="Q3" >

Inline <br>

<input type="radio" name="Q3" >

External

<br />

<input type="radio" name="Q3" >

Embedded

<br />

<br />

4. Which type of CSS is used to control the display of elements on an individual page by adding formatting instructions between head tags?

<p>

<input type="radio" name="Q4" >

Inline

<br>

<input type="radio" name="Q4" >

External

<br />

<input type="radio" name="Q4" >

Embedded <br />

<br />

5. Where in an HTML document is the correct place to refer to an external style sheet?

<p>

<input type="radio" name="Q5" >

At the top of the document

<br>

<input type="radio" name="Q5" >

In the head section

<br />

<input type="radio" name="Q5" >

In the body section <br />

<input type="radio" name="Q5" />

At the end of the document

<br />

<br />

6. Which is the correct CSS syntax?

<p>

<input type="radio" name="Q6" >

body {color: black}

<br>

<input type="radio" name="Q6" >

body:color=black

<br />

<input type="radio" name="Q6" >{body:color=black(body}



<br />

<input type="radio" name="Q6" />{body;color:black}}

<p>

7. How do you insert a comment in a CSS file?

<p>

<input type="radio" name="Q7" >

// this is a comment //

<br>

<input type="radio" name="Q7" >

// this is a comment

<br />

<input type="radio" name="Q7" >

' this is a comment <br />

<input type="radio" name="Q7" />

/* this is a comment */

<p>

8. How do you add a background color for all H1 elements?

<p>

<input type="radio" name="Q8" >

h1.all {background-color:#000000}

<br>

<input type="radio" name="Q8" >

h1 {background-color:#000000

<br />

<input type="radio" name="Q8" >

all.h1 {background-color:#000000}

<p>

9. How do you display hyperlinks without an underline?

<p>

<input type="radio" name="Q9" >

a {underline:none}

<br>

<input type="radio" name="Q9" >

a {text-decoration:no underline}

<br />

<input type="radio" name="Q9" >

a {text-decoration:none}<p>

10. How do you change the left margin of an element?

<p>

<input type="radio" name="Q10" >

margin-left

<br>

<input type="radio" name="Q10" >

text-indent

<br />

<input type="radio" name="Q10" >

margin <br />

<input type="radio" name="Q10" />

indent

<p>

11. What is the correct HTML for making a text input field?

<p>

<input type="radio" name="Q11" >

input type="textfield"

<br>

<input type="radio" name="Q11" >

textfield

<br />

<input type="radio" name="Q11" >

input type="text"<br />

<input type="radio" name="Q11" />

text input type="text"

<p>



12. What is the correct HTML for making a checkbox?

<p>

<input type="radio" name="Q12" >

input type="check"

<br />

<input type="radio" name="Q12" >

checkbox

<br />

<input type="radio" name="Q12" >

input type="checkbox"<br>

<input type="radio" name="Q12" >



check

<p>

13. What is the correct HTML for making a drop-down list?

<p>

<input type="radio" name="Q13" >

select

<br>

<input type="radio" name="Q13" >

input type="list"

<br />

<input type="radio" name="Q13" >

input type="dropdown" <br />

<input type="radio" name="Q13" />

list

<p>



14. What is the correct HTML for making a text area?

<p>

<input type="radio" name="Q14" >

input type="textbox"

<br>

<input type="radio" name="Q14" >

textarea

<br />

<input type="radio" name="Q14" >

input type="textarea"<br />

<p>



15. Which attribute specify where to send a form?

<p>

<input type="radio" name="Q15" >

action

<br>

<input type="radio" name="Q15" >

input

<br />

<input type="radio" name="Q15" >

method <br />

<p>

16. Which of the following is not a form field?

<p>

<input type="radio" name="Q16" >

reset button

<br />

<input type="radio" name="Q16" >

radio button <br />

<input type="radio" name="Q16" />

tool box

<p>

17. What tells the browser where the form starts and ends?<p>

<input type="radio" name="Q17" >

access

<br>

<input type="radio" name="Q17" >

form

<br />

<input type="radio" name="Q17" >

span <br />

<p>

18. Password fields are similar to what?<p>

<input type="radio" name="Q18" >

Text fields except text show as asterix

<br>

<input type="radio" name="Q18" >

Text area except text show as asterix

<br />

<input type="radio" name="Q18" >

Hidden fields except text show as asterix <br />

<p>

19. One line areas that allow the user to input text are called?<p>

<input type="radio" name="Q19" >

Text area

<br>

<input type="radio" name="Q19" >

Text field<br />

<input type="radio" name="Q19" >

Written field <br />

<p>

20. The value setting of a text field defines what? <p>

<input type="radio" name="Q20" >

If the value entered is a proper value

<br>

<input type="radio" name="Q20" >

The length of the field <br />

<input type="radio" name="Q20" />

What will appear in the field as the default value

<p>

21. What is the correct JavaScript syntax to write "Welcome"?

<p>

<input type="radio" name="Q21" >

"Welcome"

<br>

<input type="radio" name="Q21" >

response.write("Welcome")

<br />

<input type="radio" name="Q21" >

("Welcome")



<br />

<input type="radio" name="Q21" />

document.write("Welcome")

<p>



22. Where is the correct place to insert a JavaScript?

<p>

<input type="radio" name="Q22" >

The head section

<br>

<input type="radio" name="Q22" >

The body section

<br />

<input type="radio" name="Q22" >

Both the head section and the body section are correct



<br />

<p>

23. How do you write "Hello World" in an alert box?

<p>

<input type="radio" name="Q23" >

alertBox("Hello World")

<br>

<input type="radio" name="Q23" >

msgBox("Hello World")

<br />

<input type="radio" name="Q23" >

alert("Hello World")

<br />

<input type="radio" name="Q23" />

alertBox="Hello World"

<p>



24. How do you call a function named "myFunction"?

<p>

<input type="radio" name="Q24" >

myFunction()

<br>

<input type="radio" name="Q24" >

call myFunction()

<br />

<input type="radio" name="Q24" >

call function myFunction



<br />

<p>

25. How do you write a conditional statement for executing some code if "x" is equal to 6?

<p>

<input type="radio" name="Q25" >

if x=6 then

<br>

<input type="radio" name="Q25" >

if x=6

<br />

<input type="radio" name="Q25" >

if x==6 then

<br />

<input type="radio" name="Q25" />

if (x==6)

<p>

26. How do you create a function?

<p>

<input type="radio" name="Q26" >

function myFunction()

<br>

<input type="radio" name="Q26" >

function=myFunction()

<br />

<input type="radio" name="Q26" >

function:myFunction()



<br />

<p>

27. What is a variable?

<p>

<input type="radio" name="Q27" >

A method that is often used to display information

<br>

<input type="radio" name="Q27" >

A container for storing information

<br />

<input type="radio" name="Q27" >

A self-contained routine that performs instructions

<br />

<input type="radio" name="Q27" />

The way values are assigned to variables

<p>



28. Which of these is not a correct operator?

<p>

<input type="radio" name="Q28" >

!

<br>

<input type="radio" name="Q28" >

||

<br />

<input type="radio" name="Q28" >

&&

<br />

<input type="radio" name="Q28" />

|

<p>



29. When saving an external JavaScript files, which extension do you use?

<p>

<input type="radio" name="Q29" >

.ext

<br>

<input type="radio" name="Q29" >

.css

<br />

<input type="radio" name="Q29" >

.js

<br />

<input type="radio" name="Q29" />

.java

<p>



30. Which converts a string to floating point numbers?

<p>

<input type="radio" name="Q30" >

eval

<br>

<input type="radio" name="Q30" >

ParseFloat

<br />

<input type="radio" name="Q30" >

ParseInt

<br />

<input type="radio" name="Q30" />

None of the above

<p>

</form>

<center>
<form>
<input type="button" value="Submit" onclick="Check()" />
</form>
</center>
</body>
</html>

______________________________________________________
JavaScript

// JavaScript Document
var score=0;
var wrong="";

function Check()
{

if (CSS.Q1[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q1, ";
}
if (CSS.Q2[1].checked)
{
score++;
}
else
{
wrong=wrong+"Q2, ";
}
if (CSS.Q3[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q3, ";
}
if (CSS.Q4[0].checked)
{
score++;
}
else
{
wrong=wrong+"Q4, ";
}
if (CSS.Q5[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q5, ";
}
if (CSS.Q6[0].checked)
{
score++;
}
else
{
wrong=wrong+"Q6, ";
}
if (CSS.Q7[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q7, ";
}
if (CSS.Q8[0].checked)
{
score++;
}
else
{
wrong=wrong+"Q8, ";
}
if (CSS.Q9[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q9, ";
}
if (CSS.Q10[1].checked)
{
score++;
}
else
{
wrong=wrong+"Q10, ";
}




if (CSS.Q11[0].checked)
{
score++;
}
else
{
wrong=wrong+"Q11, ";
}
if (CSS.Q12[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q12, ";
}
if (CSS.Q13[1].checked)
{
score++;
}
else
{
wrong=wrong+"Q13, ";
}
if (CSS.Q14[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q14, ";
}
if (CSS.Q15[0].checked)
{
score++;
}
else
{
wrong=wrong+"Q15, ";
}
if (CSS.Q16[1].checked)
{
score++;
}
else
{
wrong=wrong+"Q16, ";
}
if (CSS.Q17[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q17, ";
}
if (CSS.Q18[0].checked)
{
score++;
}
else
{
wrong=wrong+"Q18, ";
}
if (CSS.Q19[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q19, ";
}
if (CSS.Q20[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q20, ";
}

if (CSS.Q21[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q21, ";
}
if (CSS.Q22[0].checked)
{
score++;
}
else
{
wrong=wrong+"Q22, ";
}
if (CSS.Q23[1].checked)
{
score++;
}
else
{
wrong=wrong+"Q23, ";
}
if (CSS.Q24[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q24, ";
}
if (CSS.Q25[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q25, ";
}
if (CSS.Q26[0].checked)
{
score++;
}
else
{
wrong=wrong+"Q26, ";
}
if (CSS.Q27[1].checked)
{
score++;
}
else
{
wrong=wrong+"Q27, ";
}
if (CSS.Q28[0].checked)
{
score++;
}
else
{
wrong=wrong+"Q28, ";
}
if (CSS.Q29[0].checked)
{
score++;
}
else
{
wrong=wrong+"Q29, ";
}
if (CSS.Q30[2].checked)
{
score++;
}
else
{
wrong=wrong+"Q30, ";
}


alert("You got "+score/30*100+"%");
alert("You got "+wrong+" wrong.");

}


My submit button would not work, I don't know what is wrong with it. Please help! Thank you again.
mllanapatriciac is offline   Reply With Quote