html - Uncaught SyntaxError: Unexpected string in my Javascript code -
i keep getting error in code , don't understand why. see line 29 of javascript.
html
<link href="styles12.css"; type="text/css" rel="stylesheet"> <link rel="stylesheet" href="styles12.css"/> <script src="registration.js"></script> <body onload="studentattendance()"> <head> <style> table, td, th { border: 1px solid black; } th { background-color: beige; color:black; } </style> </head> <h3 style= "font-size:25px; font-family:impact"> add student</h3>
firstname:
lastname:
student number:
<button onclick = "save()"><p>+add attendance</a></p> </button> <h2 style="font-size: 25px;font-family: impact">online attendance</h2> <table id= "attendancetable"> <table border="10px"> <thead> <tr> <th> student name </th> <th> student number </th> <th> </th> <th> points </th> <th style="font-size:10px;font-align: left"><em><button> edit:add student(+)</a></button></em></th> </th> </tr> </thead> <tbody> <tr> <td></td> <td></td> <td><form action="demo_form.asp" method="get"></form></td> <td></td> <td> <input type="button" value="save"></input> <button>reset</button></td> </tr> <tbody> <tr> <td></td> <td></td> <td><form action="demo_form.asp" method="get"></form></td> <td></td> </tr> <tbody> <tr> <td></td> <td></td> <td><form action="demo_form.asp" method="get"></form></td> <td></td> </tr> </tbody> </table> <form> </form> <button type="button" onlick="alert('attendence submitted')"> <strong>submit</strong></button> <p id="demo"></p> </body>
javascript
var studentno = []; var index = 0; var studentinfo = []; var newobj = []; function save() { //this function takes values text box , stores them object studentinfo[index] = { studentnumber: document.getelementbyid("studentno").value, firstname: document.getelementbyid("firstname").value, lastname: document.getelementbyid("lastname").value, }; index++; localstorage.setitem("studentrecord", json.stringify(studentinfo)); } function studentattendance() { newobj = json.parse(localstorage.getitem("studentrecord")); var table, row, cell1, cell2, cell3; table = document.getelementbyid("onlineattendance"); studentinfo = json.parse(localstorage.getitem("studentrecord")); (var index = 0; index < studentinfo.length; index++) { row = table.insertrow(index + 1); cell1 = row.insertcell(0); cell2 = row.insertcell(1); cell3 = row.insertcell(2); cell4 = row.insertcell(3); cell1.innerhtml = studentinfo[index].studentnumber; cell2.innerhtml = studentinfo[index].firstname + " " + studentinfo[index].lastname; cell3.innerhtml = studentinfo[index]. '<input type="checkbox" name="student attendance" value="absent" id="checkboxab"</input>'; } function save() { if (document.getelementbyid('checkboxab').checked) { alert("checked"); } else { alert("you didnt check it") studentinfo.points++ } } }
.
use in php concat string
+
use in javascript concat string
try
cell3.innerhtml =studentinfo[index]+ '<input type="checkbox" name="student attendance" value="absent" id="checkboxab"</input>';
Comments
Post a Comment