I am writing a piece of code with 3 files. Ill explain here for simplicity. Files are a,b,c. I have "File a" which is a HTML file "File b" is a htm file "file c" is a php file.
"File a" has "File b" embedded in it by using the HTML include functionality.
The contents of "File b" are designed in "File c".
The PHP+HTML code in file C has a onlcick fucntion which calls a Javascript method on the "file a(HTML)" page. The Javacsript function is written on the "File a". However, I am trying to pass a PHP variable in "File c".
code is as follows:
File a: Javascript function:
function toggle(id,link) {
alert("here it is!"+link);
alert("-----"+id);
var e1 = id;
var e = document.getElementById(e1);
if(e!= null){
alert("here it is!2");
if (e.style.display == ''){
alert("here it is!3");
e.style.display = 'none';
link.innerHTML = 'Show Details';
}else{
alert("here it is!4");
e.style.display = '';
link.innerHTML = 'Hide Details';
}
}
}
....
<div class="lh">
<h2>Next Event</h2>
<!--#include virtual="fileB.htm" -->
</div>
</div>
File c:
$dataNew .= "
<p>
<h4><i>". $row['description']."</i></h4>
</p>
</div>
<a href=\"javascript:toggle();\" onclick = \****"toggle('".$idDiv."',this)\****">Show Details</a><br><br><img src=\"/ec/sitepics/soldout.jpg\" width=\"150\" height=\"25\" alt=\"Buy Tickets\" /><BR>
</div>\n";
The PHP variable passed in File c on the BOLD line, is not retrieved in the Javascript function.
What kind of change do I need to do or what would I need to add?
</div>\n";
will probably render not as wished in html) – Sergio Jun 26 at 21:50