Browse Source

changed removeRandomTitle function to replace with space

main
Simon Bowie 2 years ago
parent
commit
f105d37960
1 changed files with 7 additions and 5 deletions
  1. +7
    -5
      site/public/titles.php

+ 7
- 5
site/public/titles.php View File

<? <?
foreach ($record_array as $id => $title): foreach ($record_array as $id => $title):
?> ?>
<a href="id_search.php?id=<? echo $id; ?>&core=all">
<span class="title">
<span class="title">
<a href="id_search.php?id=<? echo $id; ?>&core=all">
<? <?
echo $title; echo $title;
?> ?>
</span>
</a>
</a>
</span>
<? <?
endforeach; endforeach;
?> ?>
function removeRandomTitle() { function removeRandomTitle() {
var elts = document.getElementsByClassName("title"); var elts = document.getElementsByClassName("title");
var RandomSpan = elts[Math.floor(Math.random() * elts.length)]; var RandomSpan = elts[Math.floor(Math.random() * elts.length)];
RandomSpan.innerHTML = "";
var TextReplacement = RandomSpan.textContent.replace(/\w/g,"-");
RandomSpan.removeAttribute("href");
RandomSpan.innerHTML = TextReplacement;
} }
</script> </script>
</body> </body>

Loading…
Cancel
Save