|
|
Hi and tia to anyone that even tries to figure this one out.
I have a function defined
function ReplaceCell(cell,content,cell2,content2) {
document.getElementById(cell).innerHTML = content;
document.getElementById(cell2).innerHTML = content2;
}
it is to do a double replacement on a single click
the generated line for the td is
echo "<td width=44 background={$bgcol}><a href=`javascript:ReplaceCell('lcard','<img src=/{$picl}>','description','$description')`><img src={$pic} width=40 height=58></a></td>";
that works fine, it brings up a large pic from the small and a description of the picture.
now the problem
id like to be able to update the thumbnails in the main 'display' and have id'd it to match.
i use
echo "<td width=70><a href=`javascript:ReplaceCell('pack','{$level}','display','<? include 'pack{$level}'.php ?>')`><img src={$pic} width=50 height=110></a></td>";
this updates a cell to display a alpha/numeric display of what package of thumbnails you are looking at. the problem lies with the 2nd replacement. the <? will not echo thru and i get a blank fill. a few question
will this update if the <? and ?> is sent or will i have to refresh it and how? I have played with the quotes. and ended up just echoing just <? ?> in the 4th set, so it is the < doing it. i can cut them and the pack(var).php will show in the td.
is there an easier way like setting a variable to the original select from where like command in the database and refreshing? and how? this would be the better of the 2. it would cut down on having to copy and change a php file for each new package of pictures.
Thanks again. Ive only been coding for a couple months and the first thing i learned, frontpage and dreamweaver are nice for showing you what youve made dynamicaly, but thats it. code is best written by hand.
<Added>
ive even tried i frames. if i iframe the 'display' it cannot update the td outside of it. i dont like iframes anyway.
<Added>
another thought... can ascii characters be echoed as their numeric value?
|
|
|
|
Please carefully explain to me what you are trying to do exactly with this line:
| echo "<td width=70><a href=`javascript:ReplaceCell('pack','{$level}','display','<? include 'pack{$level}'.php ?>')`><img src={$pic} width=50 height=110></a></td>"; |
|
It appears you are trying to use the contents of an entire php include file as the value to pass to a javascript function. If that output is very large or has punctuation, I can definitely see why you'd be having trouble.
I suspect what we'll end up with is another approach to your problem.
|
|
|
|
|
|
yeah, thats what ive begone to do.
i now have a function
function getCellValue (cellOrId) {
var cell =
typeof cellOrId == 'string' ?
(document.all ? document.all[cellOrId] : document.getElementById
(cellOrId)) :
cellOrId;
if (document.all)
return cell.innerText;
else {
cell.normalize();
if (cell.firstChild.nodeType == 3)
return cell.firstChild.nodeValue;
else
return '';
}
}
@@@ which returns the value of a cell fine with
echo "<script>";
echo "javascript:alert(getCellValue ('pack')); void 0";
echo "</script>";
@@@ into an alert box, but im having trouble getting the return to become a variable i can use in my select clause. once i get that to work, i just need to refresh the cell. the refresh will pull the number and the select will show different results. saves having to create a php file for each different package too. wish i knew jscript better, the whole page would have been coded in it.
|
|
|
|
|
|
|
|