WebSite X5Help Center

 
Luis F.
Luis F.
User

Responsive Design Table with html Fragment error code  en

Автор: Luis F.
Просмотрено 1583, Подписчики 1, Размещенный 0  

Hello,

I have a responsive design table made with HTML inside a HTML Fragment.  I placed the whole code inside a div, obviously to make it responsive design.  The table also has two search boxes and you are able to sort each cullumn.

Everything works fine.

HOWEVER, when going to "STEP 5 - Export" and using the "Analyse and Optimize the Website" option, it reports that the HTML Fragment has errors.  Again, everything works, but this reports that the code has errors.

I may be exahousted but I can't see the error.

Can someone please tell me where the error is and how to fix it?

I am attaching the project file, and I'm hoping someone could return it with the solution.

And here is the code for the HTML Fragment (in case you can't open the project file).

HTML CODE section:

>------------------------START



NOTE: ask your teacher for the Class Access Code





Teacher ▼
Class ▼
Link ▼


John Doe
BLD A Room 01
Link


Jane Doe
BLD A Room 02
Link


Mike Wasasky
BLD B Room 01
Link


Michael Wargner
BLD C Room 03
Link


Frand Mason
BLD D Room 06
Link




>------------------------END

EXPERT Code:

>------------------------START

.container {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.25%;
}
.containerframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

>------------------------END

In advanced, thanks for helping.

Ps.  Please use 7zip (https://www.7-zip.org/) to extract the project file.

Размещено
3 Ответы - 1 Полезно - 1 Корректно
Luis F.
Luis F.
User
Автор

For some reason, the HTML Code was not allowed in the previous posting.

I'm trying again here:

<head>

<style>
* {
box-sizing: border-box;
font-family: arial, verdana, sans-serif;
font-size: 16px;
}

#myInput1 {
background-image: url('/css/searchicon.png');
background-position: 10px 10px;
background-repeat: no-repeat;
width: 49%;
font-size: 16px;
padding: 12px 20px 12px 40px;
border: 1px solid #ddd;
margin-bottom: 12px;
}

#myInput2 {
background-image: url('/css/searchicon.png');
background-position: 10px 10px;
background-repeat: no-repeat;
width: 49%;
font-size: 16px;
padding: 12px 20px 12px 40px;
border: 1px solid #ddd;
margin-bottom: 12px;
}

#myTable {
border-collapse: collapse;
width: 100%;
border: 1px solid #ddd;
font-size: 18px;
font-family: arial, verdana, sans-serif;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

#myTable th, #myTable td {
text-align: left;
padding: 12px;
}

#myTable tr {
border-bottom: 1px solid #ddd;
}

#myTable tr.header, #myTable tr:hover {
background-color: #566573;
color: #f2f2f2;
font-family: arial, verdana, sans-serif;
}

tr:nth-child(even) {
background-color: #f2f2f2
}
</style>

</head>

<body>

<div class="container" style="width: 100%; height: 100%; overflow-y: auto;">

<br />
<h1>NOTE: ask your teacher for the Class Access Code</h1>
<br />
<br />

<input type="text" style="float: left" id="myInput1" onkeyup="myFunction1()" placeholder="Search by teacher..." title="Type in a name">
<input type="text" style="float: right" id="myInput2" onkeyup="myFunction2()" placeholder="Search by class..." title="Type in a class">

<table id="myTable">
<tr class="header">
<th onclick="sortTable(0)" style="width:40%;">Teacher <font color="#58D68D">▼</font></th>
<th onclick="sortTable(1)" style="width:40%;">Class <font color="#58D68D">▼</font></th>
<th onclick="sortTable(1)" style="width:20%;">Link <font color="#58D68D">▼</font></th>
<!--When a header is clicked, run the sortTable function, with a parameter, 0 for sorting by names, 1 for sorting by country:-->
</tr>

<tr>
<td>John Doe</td>
<td>BLD A Room 01</td>
<td><a href="https://schoology.com" rel="noopener noreferrer" target="_blank">Link</a></td>
</tr>

<tr>
<td>Jane Doe</td>
<td>BLD A Room 02</td>
<td><a href="https://schoology.com" rel="noopener noreferrer" target="_blank">Link</a></td>
</tr>

<tr>
<td>Mike Wasasky</td>
<td>BLD B Room 01</td>
<td><a href="https://schoology.com" rel="noopener noreferrer" target="_blank">Link</a></td>
</tr>

<tr>
<td>Michael Wargner</td>
<td>BLD C Room 03</td>
<td><a href="https://schoology.com" rel="noopener noreferrer" target="_blank">Link</a></td>
</tr>

<tr>
<td>Frand Mason</td>
<td>BLD D Room 06</td>
<td><a href="https://schoology.com" rel="noopener noreferrer" target="_blank">Link</a></td>
</tr>

</table>

<script>
function myFunction1() {
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("myInput1");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
</script>
<script>
function myFunction2() {
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("myInput2");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[1];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
</script>
<script>
function sortTable(n) {
var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
table = document.getElementById("myTable");
switching = true;
//Set the sorting direction to ascending:
dir = "asc";
/*Make a loop that will continue until
no switching has been done:*/
while (switching) {
//start by saying: no switching is done:
switching = false;
rows = table.rows;
/*Loop through all table rows (except the
first, which contains table headers):*/
for (i = 1; i < (rows.length - 1); i++) {
//start by saying there should be no switching:
shouldSwitch = false;
/*Get the two elements you want to compare,
one from current row and one from the next:*/
x = rows[i].getElementsByTagName("TD")[n];
y = rows[i + 1].getElementsByTagName("TD")[n];
/*check if the two rows should switch place,
based on the direction, asc or desc:*/
if (dir == "asc") {
if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
//if so, mark as a switch and break the loop:
shouldSwitch= true;
break;
}
} else if (dir == "desc") {
if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
//if so, mark as a switch and break the loop:
shouldSwitch = true;
break;
}
}
}
if (shouldSwitch) {
/*If a switch has been marked, make the switch
and mark that a switch has been done:*/
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
switching = true;
//Each time a switch is done, increase this count by 1:
switchcount ++;
} else {
/*If no switching has been done AND the direction is "asc",
set the direction to "desc" and run the while loop again.*/
if (switchcount == 0 && dir == "asc") {
dir = "desc";
switching = true;
}
}
}
}
</script>

</div>

</body>

</html>

Читать больше
Размещено От Luis F.
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator

... post the LINK of the page with the problem ...
... caution! unique page TAGs must not be used in the extra code: <HTML> | <HEAD> | <BODY>
... the <STYLE> TAG should be placed in the </HEAD> section...

.

Читать больше
Размещено От  ‪ KolAsim ‪ ‪
Luis F.
Luis F.
User
Автор

There is no link.  The project is not live on the web.

I attached the project file.  The page with the problem is the HOME page.

That beind said, you SOLVED IT.

I was so exausted that I totally overlooked such a basic step.

Thanks.

Читать больше
Размещено От Luis F.