ActionsDev

3 replies to this thread. Most Recent

waltd

1 Jul 2008, 2:20 pm

Grabbing the PageDiv

I have this little utility function that returns the PageDiv if it exists, ready for extending.

function GetPageDiv(){
    var divs = fwDocument.fwTags.fwFindAll('div');
    for (i in divs){
        if (divs[i].id && divs[i].id.toString() == '"PageDiv"') return divs[i];
    }
    return false;
}

Is there a simpler way to do this that I’m overlooking?

Thanks,

Walter

quote

Freeway user since 1997

www.walterdavisstudio.com

Joe Billings

1 Jul 2008, 3:12 pm

This would also work:

function GetPageDiv(){
    var div = fwDocument.fwTags.fwFind("body").fwFind("div");
    if (div.id && divs[i].id.toString() == '"PageDiv"')
        return div;
    else
        return false;
}

Joe

On 1 Jul 2008, at 15:20, waltd wrote:

I have this little utility function that returns the PageDiv if it exists, ready for extending.

function GetPageDiv(){ var divs = fwDocument.fwTags.fwFindAll(‘div’); for (i in divs){ if (divs[i].id && divs[i].id.toString() == ‘“PageDiv”’) return divs[i]; } return false; }

Is there a simpler way to do this that I’m overlooking?

Thanks,

Walter

quote

For free and responsive Freeway support visit www.softpress.com/support/help_desk.php

Tim Plumb

1 Jul 2008, 3:13 pm

Hi Walter, You could try and sped things up by doing a “I’m feeling lucky’ version of the action; :-) function GetPageDiv(){ var firstdiv = fwDocument.fwTags.fwFind(‘div’); if (firstdiv){ if (firstdiv.id && firstdiv.id.toString() == ‘“PageDiv”’) return firstdiv; } return false; } This would cut down on the looping through the divs but may not find the PageDiv (an action could add a parent div in there) although ‘most’ of the time the 1st div is the one you are looking for. Generally I think the way you are doing things is how I would tackle the issue. Regards, Tim.

On 1 Jul 2008, at 07:20, waltd wrote:

I have this little utility function that returns the PageDiv if it exists, ready for extending.

function GetPageDiv(){ var divs = fwDocument.fwTags.fwFindAll(‘div’); for (i in divs){ if (divs[i].id && divs[i].id.toString() == ‘“PageDiv”’) return divs[i]; } return false; }

Is there a simpler way to do this that I’m overlooking?

Thanks,

Walter

FreewayActions.com - Freeware and shareware actions for Freeway Express & Pro.


Protect your mailto links from being harvested by spambots with Anti Spam. Only available at FreewayActions.com


www.freewayactions.com

quote


Extend Freeway the way you want with FreewayActions.com

www.freewayactions.com

Back to Top

Joe Billings

1 Jul 2008, 3:14 pm

But then again, if any Actions have added any divs between the body and the PageDiv it won’t…

On 1 Jul 2008, at 16:12, Joe Billings wrote:

This would also work:

function GetPageDiv(){ var div = fwDocument.fwTags.fwFind(“body”).fwFind(“div”); if (div.id && divs[i].id.toString() == ‘“PageDiv”’) return div; else return false; }

Joe

On 1 Jul 2008, at 15:20, waltd wrote:

I have this little utility function that returns the PageDiv if it exists, ready for extending.

function GetPageDiv(){ var divs = fwDocument.fwTags.fwFindAll(‘div’); for (i in divs){ if (divs[i].id && divs[i].id.toString() == ‘“PageDiv”’) return divs[i]; } return false; }

Is there a simpler way to do this that I’m overlooking?

Thanks,

Walter

quote

For free and responsive Freeway support visit www.softpress.com/support/help_desk.php

FreeCounter