Tuesday, September 29, 2009

Run javascript code automatically

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.

My first post

Hello, my name is Diego Arregui and this is my first post. Recently I started in this world of programming and I see many of my colleagues have a blog, so I decided to have mine too.

I don't know very well I'm going to tell you, but I start telling a bit about myself:

I'm PHP and HTML programmer, I work in a programming consultant, I'm married and I have a son.

Working many years in the kiosk of my dad, Maxikiosco Arregui 24, I recommend it. There were many years there. When I finished high school I did not want to continue studying, so dad put me to work at the maxikiosk. I had many options at the time and needed Dad to help him, things were complicated, we had to save the store, as the tv advertisement man says.

I always liked programming, I managed the pc's at cyber cafe we had in the maxikiosco and then always i have some computer skills. So last year I enrolled in the Club of Programmers to take some courses and get into this fascinating world of programming. I had completing the HTML course and PHP for begginers and my girlfriend got pregnant. So I had to leave courses and return to the kiosk. But a little over a month I got my dream and I'm working in IT Solvers, a programming consultant, doing what I like.

Although just starting, between this and turn at night in the Dad's Maxikiosk, I can support my wife and my son, so I'm happy.
Another of my passions is music, but I will tell you in another post.

Gradually I will be telling my stories, and my concerns with programming. I send greetings to all and wait for your your messages.
Bloggers - Meet Millions of Bloggers