0
Hello, I need to call these two separate functions as this only one code works as I do for both work?
<script type="text/javascript">
window.onload = function() {
if ('a' == 'a')
{
document.getElementById("nomeprodut").innerHTML = "Altera nome do produto";
}
}
</script>
<div id="nomeprodut"></div>
<script type="text/javascript">
window.onload = function() {
if ('b' == 'b')
{
document.getElementById("b").innerHTML = "grghgh";
}
}
</script>
<div id="b"></div>
I may be wrong, but the onload event only occurs 1 time, and so only calls the last function that defined as
onload, if I’m not mistaken the last one overwrites the previous one. Without putting everything in the sameonloador at least in separate functions I think there is no way.– Neuber Oliveira
@Neuberoliveira Concerteza should be the same problem, the page generates each separate javascript, would have as I do a function equal to this without onload sera?
– Josimara
Some special reason to be carrying several Jss with an onload in each one, there is no way to move everything to one place only?
– Neuber Oliveira
@Josimara asked a recent question about onload, maybe the other function can help you!
– Marconi
@Neuberoliveira I have a page that generates a list of products, each product generates a javascript, I can only use html/javascript
– Josimara
@Marconi That’s just what I needed, Thanks...
– Josimara
@Good Josimara I could help :)
– Marconi