I think you’re asking how to put that piece of code inside HTML…?
If so, it’s easy. Put <script>
tags inside your html:
<script>
function url() {
var x = window.location.pathname;
if (x=="/index/index.php") {
}
}
</script>
And your JavaScript code will work.
If you’re saying you need to write your whole page in JavaScript, which, in my brain, is crazy, then you have to use document.write();
and write each line of code:
<script>
document.write("<section id=\"ramadan\" style=\"min-width:1200px\">");
document.write("<div class=\"container\">");
etc. etc.
</script>
7
solved Code HTML into JavaScript code [closed]