These are my iframes:
<div class="iframe">
<iframe src="iframe1.html" name="iframe_a">
</iframe>
</div>
<div class="iframe2">
<iframe src="iframe1.html" "name="iframe_a2">
</iframe>
</div>
In HTML, with JavaScript, I'm using the following and it works:
<script>
function changeLink(link) {
parent.iframe_a2.location=link;
}
</script>
HTML Code:
<li>
<a href="select1.php" target="iframe_a"
onClick="changeLink('select2.php')">Home</a>
</li>
In PHP I have almost the same code but the onclick
function is not running, only the
<a href='select1.php?page=$i' target='iframe_a'
changed. Meaning there's nothing happen in my frame 2 -- iframe_a2
(onclick).
Here is the code:
<script>
function changeLink(link) {
parent.iframe_a2.location=link;
}
</script>
PHP Code:
echo ("<a href='select1.php?page=$i' target='iframe_a'
onClick='changeLink('select2.php?page=$i)'>Home</a>");
You have error in this code:
echo ("<a href='select1.php?page=$i' target='iframe_a' onClick='changeLink('select2.php?page=$i)'>Home</a>")
Try this:
echo ("<a href='select1.php?page=$i' target='iframe_a' onClick=\"changeLink('select2.php?page=$i')\">Home</a>")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.