Friday, March 5, 2010

After getting communication to the server working I am starting to build the front end a little. Of course this is where the difficulty of working cross browser starts rearing its ugly head. I am developing on my home computer which is a Mac. I then test on my work computer which is Windows and then for kicks I look at the website on my son's ipod touch. I am only looking at Firefox on the Mac. IE7 in Windows and of course safari on the itouch. I am very picky about not creating any errors so I have all debugging on. I don't know if most people are aware, but most sites like Yahoo and Google will raise a bunch of errors but function. It probably isn't important, but I am trying to keep the error console free.

All I was going to do was put up a username and password text and login to the server. This object here was not the first object that was created, but one that developed after I ran into problems. I was simply trying to center the objects. The parameter o is for the calling function to provide the object to which this div should be appended. It very well could be the document.body. After all the hunting and pecking on the web I found that this centering worked the best for me.



function myDiv(o) {
var myself = this;
myself.mydiv = document.createElement('div');
myself.mydiv.style.position = "absolute";
o.appendChild(myself.mydiv);
myself.getObj = function(){return myself.mydiv;};
myself.center = function (x,y) {
myself.mydiv.style.top = parseInt(myInnerHeight()/2)-y + "px";
myself.mydiv.style.left = parseInt(myInnerWidth()/2)-x + "px";
}

}

No comments:

Post a Comment