0

I am attaching my .js as well as php file, no output is being displayed on the screen not even the __________ placed in the <p> tag ,the php file is only up to the <p> tag where the id for the .js file is attached.

js code:

var timeleft = 600;
var startTime = 0;
var currentTime = 0;

function convertSeconds(s) {
    var min = floor(s / 60);
    var sec = s % 60;
    return nf(min, 2) + ':' + nf(sec, 2);
}

var ding;

function preload() {
    ding = loadSound("ding.mp3");
}

function setup() {
    noCanvas();
    startTime = millis();


    var params = getURLParams();
    console.log(params);
    if (params.minute) {
        var min = params.minute;
        timeleft = min * 60;
    }

    var timer = select('#timer');
    timer.html(convertSeconds(timeleft - currentTime));

    var interval = setInterval(timeIt, 1000);

    function timeIt() {
        currentTime = floor((millis() - startTime) / 1000);
        timer.html(convertSeconds(timeleft - currentTime));
        if (currentTime == timeleft) {
            ding.play();
            clearInterval(interval);
            //counter = 0;
        }
    }

}

html code:

<html>
<head>
    <title>online examination system</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <link rel="stylesheet" type="text/css" href="style2.css">
    <meta charset="UTF-8">
    <script language="javascript" type="text/javascript  src=" libraries
    /p5.js</script>
    < script language = "javascript"
    src = "libraries/p5.dom.js" ></script>
    <script language="javascript" src="libraries/p5.sound.js"></script>
    <script language="javascript" type="text/javascript" src="sketch.js"></script>
</head>
<body>
<div class=header>
    <img class="img-style" src="Online-Examination-System-Banner.jpeg" width="1166px" height="250px">
</div>
<div class="top">
    <ul id="navigation">
        <li><a href="index.php">HOME</a></li>
        <li><a href="aboutus.php">ABOUT US</a></li>
        <li><a href="">CONTACT US</a></li>
        <li><a href="examination.php">EXAMINATION</a></li>
        <li><a href="login.php">LOGIN</a></li>
        <li><a href="logout.php">LOGOUT</a></li>

    </ul>
</div>
<p style="font-size:40;color:white;font-weight:bolder;">Welcome !</p>
<p id="timer" style="color:white;font-family:courier;font-size:28px; float:center;">______</p>
<form action="cplus.php" method="post" >
<div style="margin-top:10px;margin-right:85px;margin-left:100px;margin- bottom:20px;background:rgba(0,0,0,0.5)">
<p style="color:white;font-family:courier;font-size:18px">1. Which of the following correctly declares an array?</p>  <br> 
       <input  class="exam-btn" type="radio" name="q1" id="q1-a" value="A" checked>
           <label for="q1-a" style="color:white;font-family:courier;font-size:18px">int array[10];</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q1" id="q1-b" value="B">
           <label style="color:white;font-family:courier;font-size:18px">int array;</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q1" id="q1-c" value="C">
           <label style="color:white;font-family:courier;font-size:18px">array{10};</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q1" id="q1-d" value="D">
           <label style="color:white;font-family:courier;font-size:18px">array array[10];</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <br><br><br><br>

   <p style="color:white;font-family:courier;font-size:18px">2. What is the index number of the last element of an array with 9 elements?</p>  <br> 
       <input  class="exam-btn" type="radio" name="q2" id="q2-a" value="A">
           <label style="color:white;font-family:courier;font-size:18px">9</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q2" id="q2-b" value="B" checked>
           <label style="color:white;font-family:courier;font-size:18px">8</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q2" id="q2-c" value="C">
           <label style="color:white;font-family:courier;font-size:18px">0</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q2" id="q2-d" value="D">
           <label style="color:white;font-family:courier;font-size:18px">programmer defined</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <br><br><br><br>

<p style="color:white;font-family:courier;font-size:18px">3. Which of the following accesses the seventh element stored in array?</p>  <br> 
       <input  class="exam-btn" type="radio" name="q3" id="q3-a" value="A" checked>
           <label style="color:white;font-family:courier;font-size:18px">array[6];</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q3" id="q3-b" value="B" >
           <label style="color:white;font-family:courier;font-size:18px">array[7];</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q3" id="q3-c" value="C" >
           <label style="color:white;font-family:courier;font-size:18px">array(7);</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q3" id="q3-d" value="D" >
           <label style="color:white;font-family:courier;font-size:18px">array;</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <br><br><br><br>

<p style="color:white;font-family:courier;font-size:18px">4. Which of the following gives the memory address of the first element in array?</p>  <br> 
       <input  class="exam-btn" type="radio" name="q4" id="q4-a" value="A" >
           <label style="color:white;font-family:courier;font-size:18px">array[0];</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q4" id="q4-b" value="B" >
           <label style="color:white;font-family:courier;font-size:18px">array[1];</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q4" id="q4-c" value="C" >
           <label style="color:white;font-family:courier;font-size:18px">array[2];</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q4" id="q4-d" value="D" checked>
           <label style="color:white;font-family:courier;font-size:18px">none</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <br><br><br><br>

<p style="color:white;font-family:courier;font-size:18px">5. What will be the output of this program?</p>  <br> 
   <pre style="color:white;font-family:courier;font-size:18px">
           #include <stdio.h>

    using namespace std;

    int array1[] = {1200, 200, 2300, 1230, 1543};

    int array2[] = {12, 14, 16, 18, 20};

    int temp, result = 0;

    int main()

    {

        for (temp = 0; temp < 5; temp++) 

        {

            result += array1[temp];

        }

        for (temp = 0; temp < 4; temp++)

        {

            result += array2[temp];

        }

        cout << result;

        return 0;

    }

   </pre>
   </pre>
   <input  class="exam-btn" type="radio" name="q5" id="q5-a" value="A" >
           <label style="color:white;font-family:courier;font-size:18px">6553</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q5" id="q5-b" value="B" checked>
           <label style="color:white;font-family:courier;font-size:18px">6533</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q5" id="q5-c" value="C" >
           <label style="color:white;font-family:courier;font-size:18px">6522</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input  class="exam-btn" type="radio" name="q5" id="q5-d" value="D" >
           <label style="color:white;font-family:courier;font-size:18px">12200</label>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <br><br><br><br>

<! 1.  token                  2.  sensitive              3.  identifiers

4.  octal                   5.  \0n  --> 
<p style="color:white;font-family:courier;font-size:18px">6.The smallest  individual unit in a program is known as a …………………… </p>  <br> 
       <p style="color:white;font-family:courier;font-size:18px">ans</p><input  class="exam-btn" type="text" name="" >
<br><br><br><br>

<p style="color:white;font-family:courier;font-size:18px">7.C++ Language is case …………………. </p>  <br> 
       <p style="color:white;font-family:courier;font-size:18px">ans</p><input  class="exam-btn" type="text" name="" >
<br><br><br><br>

<p style="color:white;font-family:courier;font-size:18px">8.An ………………… is a long sequence of letters and digits. </p>  <br> 
       <p style="color:white;font-family:courier;font-size:18px">ans</p><input  class="exam-btn" type="text" name="" >
<br><br><br><br>

<p style="color:white;font-family:courier;font-size:18px">9.A sequence of digits beginning with zero is considered to be …………….number. </p>  <br> 
       <p style="color:white;font-family:courier;font-size:18px">ans</p><input  class="exam-btn" type="text" name="" >
<br><br><br><br>

<p style="color:white;font-family:courier;font-size:18px">10.………………. escape sequence represents the given number in octal form. </p>  <br> 
       <p style="color:white;font-family:courier;font-size:18px">ans</p>
       <input  class="exam-btn" type="text" name="" >
<br><br><br><br>
<input type="submit" value="Submit quiz">
</div>
<div style="font-size:18px;color:white;font-weight:bolder;">
   <?php
   $answer1; 
   $answer2; 
   $answer3; 
   $answer4; 
   $answer5;   



   $answer1 = $_POST['q1'];
   $answer2 = $_POST['q2'];
   $answer3 = $_POST['q3'];
   $answer4 = $_POST['q4'];
   $answer5 = $_POST['q5'];

   $totalcorrect;
   $totalcorrect = 0;

   if($answer1 == "A") {$totalcorrect++;}
   if($answer2 == "B") {$totalcorrect++;}
   if($answer3 == "A") {$totalcorrect++;}
   if($answer4 == "D") {$totalcorrect++;}
   if($answer5 == "B") {$totalcorrect++;}

   echo "total correct answers are".$totalcorrect;
   ?>
   </div>
    </div>
</form>
   </body>
</html>
halfer
  • 18,701
  • 13
  • 79
  • 158
nilesh
  • 1
  • 3
  • If not even the HTML is showing up, then it's not your JS that's broken, it's something else. You say that _"the php file is only up to the

    tag"_, can you please let us know how your loading your PHP files in your application?

    – Magnus Eriksson May 06 '18 at 06:42
  • wait let me upload the entire file then. – nilesh May 06 '18 at 06:43
  • Have you error reporting turned on? Have you checked your error log? A good idea is also to turn `display_errors` on in your local PHP environment. Read more here: [How do I get PHP errors to display?](http://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display) – Magnus Eriksson May 06 '18 at 06:43
  • Ah. ` – Magnus Eriksson May 06 '18 at 06:44
  • i have closed it now still not workin @MagnusEriksson – nilesh May 06 '18 at 06:55
  • 1
    So, have you followed my other suggestion? Checking for errors? – Magnus Eriksson May 06 '18 at 06:57
  • Please update the code with _exactly_ what you have - the ` – halfer May 06 '18 at 07:15
  • The JS loading for `p5.dom.js` looks broken as well. – halfer May 06 '18 at 07:16

0 Answers0