html5 - Trying to display data from a database in HTML tags using Javascript -


i'm trying call function in home page change content of article in html placeholders info database before page loads. keep getting error saying i'm missing formal parameter. have done wrong?

the html:

<article id="article1">     <img src="images/sadface.png" alt="the image didn't load, sorry" id="img0">     <h4 id="heading0">not working</h4>     <p id="p0">this item hasn't loaded, sorry</p>     <script>         window.onload = function splashfunction(0);     </script> </article> 

and javascript:

function splashfunction(x){  document.getelementbyid("img" + x).src="images/cart2.jpg";  document.getelementbyid("heading" + x).innerhtml="cart";  document.getelementbyid("p" + x).innerhtml="cart"; }; 

in order change dom call database have use ajax, hope know that.

as code, defining function again on window.onload. call function use name, such:

window.onload = splashfunction(0); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -