-2
I am making a website that I am required to use HTML, CSS and Javascript at most. It’s just that many things I need Php I can’t use.
So I’ve been searching for a synonym of include()
and found the following, which helped in parts:
<select id="cidade" name="cidade">
<option selected disabled>-- Selecione uma cidade --</option>
<option value="atibaia">Atibaia - SP</option>
<option value="bragancapta">Bragança Paulista - SP</option>
</select>
<script>
document.getElementById("cidade").onchange=function() {
document.getElementById("inserir").innerHTML = "<object type='text/html' data='cidades/" + this.value + "/index.html' width='100%'>";
}
</script>
<p id="inserir"></p>
Okay, but what’s the problem? It creates a scroll bar on the side. I know how to remove with CSS, but the text that was inserted scrolls only within the div
and I wanted to make it as if the inserted text is part of the page, as it works in include()
of Php. The question is, how do the mechanics of Javascript in that case it shall be the same as Php?
Print to illustrate: https://imgur.com/a/V9AGLgB
Increase the element size with the attribute
height
(via CSS)– Valdeir Psr
This happens because you are loading in p as if it were a new html, so the bar, pq used
object
?– LeAndrade
@Valdeirpsr got more or less in his comment.
– Lucas Josivan