You need to sign in to do that
Don't have an account?
Javascript within apex:pageBlockTable Related List ?
Hello,
I have an apex:pageBlockTable that displays a picture for eacg record in the list of record. I want to get the size of each picture using Javascrip width. How do I do that? I am stuck with the following problem in the code below: the id="AIHURLPicture1" is convey accross all records in the table, so it can not work. How do I get each picture to have a different Id? Thanks in advance for your support. Have a good weekend, Jerome
<apex:pageBlockTable value="{!vehicleList}" var="vehicle" id="vehicletable">
<apex:column>
<img src="{!vehicle.URLPicture1__c}" id="URLPicture1" />
<script>
var URLPict1JS = document.getElementById("URLPicture1");
var pict1 = new Image();
pict1.src=URLPict1JS.src;
var width = pict1.width;
</script>
....
what you can do as an alternative is to specify the class name within the img tag, i.e:
and then use document.getElementsByClassName to get the array/list of all the pictures you intend to manipulate, and iterate to it, i.e.:
NOTE: i haven't tested the posted codes. But this would give you an idea.
Thank you; I will test this this afternoon and keep you posted.