ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  javascript , php echo, php include  PJ at 02:57 on Wednesday, July 06, 2005

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.


ive even tried i frames. if i iframe the 'display' it cannot update the td outside of it. i dont like iframes anyway.


another thought... can ascii characters be echoed as their numeric value?

  Re: javascript , php echo, php include  Troy Wolf at 15:38 on Friday, July 08, 2005

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.
Troy Wolf: site expert
SnippetEdit Website Editor

  Re: javascript , php echo, php include  PJ at 17:56 on Friday, July 08, 2005

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)) :
if (document.all)
return cell.innerText;
else {
if (cell.firstChild.nodeType == 3)
return cell.firstChild.nodeValue;

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.

CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums

Recent Forum Threads
• Global.Mapper.v15.2.3.b060614
• Geometric_Glovius_Pro_v3.6.1
• VERO.SurfCAM.v2014
• Schlumberger.Petrel.V2013.2
• Petrel.V2013.2
• Altair.HyperWorks.v12
• VoluMill.v6.1
• VoluMill.NEXION.6
• VERO.SurfCAM.v2014

Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text

© Copyright 2001-2014