As I said before, just started in programming and am learning many new things all the time. Recently something happened I think I have to share if he serves another.
Here in my work, there is a html page that is loaded and wanted to finish loading when to call a function that is on the server. This is done with ajax they told me. Still do not quite understand that is the ajax, but they said all I had to do is run a javascript function as soon as the page loads.
So I searched in the great friend Google and found something that can serve to more than anyone:
There is a method of html called onload, and the html calls when I finish loading all the code. All you have to do is pass to this method the name of the function we want to run and play. It looks like magic, but no. Programming in HTML is more than just assembling tables and put the page title.
The code would look like:
< body onload="myFunction()" >
body is the body tag of html, and myFunction would be the name of the function we want to run. For this to work, we obviously must have the function myFunction before. It throws an error if do not find it.
Well, he works for me, I hope they serve, ask me any question.


No comments:
Post a Comment
No abuse please! :)