One more old skool Pollock

April 25th, 2008

Your god ….

April 23rd, 2008

Not saying YOUR god is a dick, or THE god is a dick, more that A god is a dick …..

Your god is a dick

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Google] [StumbleUpon]

Cartoons

Ajax wrapper class

April 22nd, 2008

I’m not really a big fan of “AJAX” ( yes, I put it in quotes ). To be honest, I’ve being doing AJAX type stuff since the dawn of Javscript and IFRAMES, but now it has a name and everyone is using it. My pet hate is AJAX for the sake of AJAX, reloading 5mb of data when a simple page refresh will do.

Saying all that, what AJAX I do now, I do with this great wrapper class

http://www.cmarshall.net/MySoftware/ajax/

Works like a charm and really simple to impliment. If I get the time, I’ll add in some very simple PHP examples on how to make re-usable AJAX type code for populating lists etc.

[-]

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Google] [StumbleUpon]

Javascript

People who are spamming me

March 3rd, 2008

Handling bookmarks / named anchors in an IFRAME

February 14th, 2008

So, you are using IFRAMES, good on you. You have a nice document with lots of names anchors, but you find when you click on the bookmark link, the whole window, parent and all, scrolls into view. Pain in the ass. To get around it, use Javascript as such …

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function findPosY(obj)
{
  var curtop = 0;
  if(obj.offsetParent)
    while(1)
    {
        curtop += obj.offsetTop;
        if(!obj.offsetParent)break;
        obj = obj.offsetParent;
    }
  else if(obj.y)
    curtop += obj.y;
  return curtop;
}
 
 
function scroll(element){
  p = findPosY(document.getElementById(element));
  window.scrollBy(0,p);
}

The findPosY is not my code, sorry, cant remember the original author - if I find you I will credit you.

In your HTML use

<a href="javascript:scroll('A');">A

and for the named anchor use any tag and add the ID for the link, ie

<h3 id="A">A

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Google] [StumbleUpon]

Javascript