You need to sign in to do that
Don't have an account?
Sales Logistix
Using document.getElementsbyName() in Visualforce page
I have a VisualForce page that is a drop-in element used in a standard page layout. In my VF, I've got Javascript that's trying to get some elements of the main page and then run a pre-existing method, like this:
var imgs = document.getElementsByTagName('img');
for(var x in imgs)
{
if ( imgs[x].className=='hideListButton' && imgs[x].alt.indexOf("ICOMM") != -1)
{ twistSection(imgs[x]) ; }
}
but the imgs collection is always showing up empty. fine, I then try to use parent.document.getElementsByName() and it blows up, same thing with top.document.getElementsByName().
this code works fine if it's embedded in a JS button on the same page...but VF in this use case is somehow obscuring the parent and top pages.
The goal of this code is to make it so that some collapsible sections of the page are collapsed by default on page load.
Ideas???
var imgs = document.getElementsByTagName('img');
for(var x in imgs)
{
if ( imgs[x].className=='hideListButton' && imgs[x].alt.indexOf("ICOMM") != -1)
{ twistSection(imgs[x]) ; }
}
but the imgs collection is always showing up empty. fine, I then try to use parent.document.getElementsByName() and it blows up, same thing with top.document.getElementsByName().
this code works fine if it's embedded in a JS button on the same page...but VF in this use case is somehow obscuring the parent and top pages.
The goal of this code is to make it so that some collapsible sections of the page are collapsed by default on page load.
Ideas???
--KC