<script> | <script> | ||||
let text = "<?php echo $_POST["search"]; ?>"; | let text = "<?php echo $_POST["search"]; ?>"; | ||||
upperText = text.toUpperCase(); | upperText = text.toUpperCase(); | ||||
result = "<span style='color:green'>" + upperText + "</span>"; | |||||
result = "<span style='color:orange'>" + upperText + "</span>"; | |||||
const collection = document.getElementsByClassName("search_term"); | const collection = document.getElementsByClassName("search_term"); | ||||
for (let i = 0; i < collection.length; i++) { | for (let i = 0; i < collection.length; i++) { | ||||
collection[i].innerHTML = result; | collection[i].innerHTML = result; |
<body> | <body> | ||||
<div class="container"> | <div class="container"> | ||||
<button class="float-end btn btn-danger" onclick="removeRandomTitle()">-</button> | |||||
<?php | <?php | ||||
foreach ($random_titles as $record_array): | foreach ($random_titles as $record_array): | ||||
foreach ($record_array as $id => $title): | foreach ($record_array as $id => $title): | ||||
?> | ?> | ||||
<a href="id_search.php?id=<? echo $id; ?>&core=all"> | <a href="id_search.php?id=<? echo $id; ?>&core=all"> | ||||
<span class="title"> | |||||
<? | <? | ||||
echo $title; | |||||
echo $title; | |||||
?> | ?> | ||||
</span> | |||||
</a> | </a> | ||||
<? | <? | ||||
endforeach; | endforeach; | ||||
?> | ?> | ||||
endforeach; | endforeach; | ||||
?> | ?> | ||||
</div> | </div> | ||||
<script> | |||||
function removeRandomTitle() { | |||||
var elts = document.getElementsByClassName("title"); | |||||
var RandomSpan = elts[Math.floor(Math.random() * elts.length)]; | |||||
RandomSpan.innerHTML = ""; | |||||
} | |||||
</script> | |||||
</body> | </body> | ||||
</html> | </html> |