Link to home
Create AccountLog in
Avatar of dcass
dcassFlag for United States of America

asked on

iframe to call iframe

This code takes a huge amount of time to load the thousands of records it might load.
I've been told to make it call a blank.html so that it does not load all the code in the iframe on load.
i.e.  substitute details.php with a blank.html and then somehow on mouseover, do the actual load to details.php so that basically no load time is sucked up by details.php.
function show(temp)

{

  document.getElementById(temp).style.display="inline-block";

}

function hide(temp) 

{

  document.getElementById(temp).style.display="none";

}

<div class='divclass'><b> 
<img src="Images/button" id='test' onmouseover="show('divname');" onmouseout="hide('divname');">

</td><td>

  <div id="display" style="border:0;display:none;position:absolute;">

     <iframe src="details.php?tmp1=xxx&tmp2=yyy&tmp3=aaa&tmp4=bbb"></iframe>

  </div>

</div>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Greg Alexander
Greg Alexander
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of dcass

ASKER

looks like it will.  I'll try it then let u know!
Avatar of dcass

ASKER

for some reason this code is not working - I have an alert 1st thing in the javascript and it does not appear.  What am I doing wrong?
<?php
<img src='Images/search_button_16.png' alt='View' title='View' id='$tmp' onmouseover='show($a, $tmp1, $tmp2, $tmp3, $tmp4)' onmouseout='hide($a);'>";
?>

Open in new window

The syntax you posted is not correct, if you enclose the img tag within php tags, you need to use "echo" or something like that to output the HTML tag. Furthermore, variables do not get expanded when written within single quotes, so without checking the above code, this is what needs to be done to make your code snippet working:

 
<?php
echo '<img src="Images/search_button_16.png" alt="View" title="View" id="' . $tmp . '" onmouseover="show(' . $a . ', ' . $tmp1 . ', ' . $tmp2 . ', ' . $tmp3 . ', ' . $tmp4 . ')" onmouseout="hide(' . $a . ');">';
?>

Open in new window

Avatar of dcass

ASKER

Sorry - just learning.
This works now but there must be something wrong with this function because the alert here is correct, but I put an alert onload in the bbDetails.php and it never gets there.
bbDetails was working when passing with code attached in first post, so I don't believe it's there.
Also, I moved the alert to below the .src statement and it never got there, so I'm sure it's in that statement.
Thanks - you've got me this far - I appreciate it.
function show(temp, v1, v2, v3, v4)

{
alert(v1+","+v2+","+v3+","+v4);
  document.getElementById("content"+temp).src = "bbDetails.php?tmp1="+v1+"&tmp2="+v2+"&tmp3="+v3+"&tmp4="+v4;

  document.getElementById("tempIn"+temp).style.display="inline-block";

}

then bbDetails.phpb (no response on mouseover):
<?php


$tmp1 = "";

$tmp2 = "";

$tmp3 = "";

$tmp4 = "";

if (isset($_GET["tmp1"])) {

   $tmp1 = $_GET['tmp1'];

}

if (isset($_GET["tmp2"])) {

   $tmp2 = $_GET['tmp2'];

}

if (isset($_GET["tmp3"])) {

   $tmp3 = $_GET['tmp3'];

}

if (isset($_GET["tmp4"])) {

   $tmp4 = $_GET['tmp4'];

}

echo "tmp1= $tmp1 : tmp2=$tmp2<BR>";

?>

Open in new window

Avatar of dcass

ASKER

I think it's the spaces in the v fields.
Avatar of dcass

ASKER

Thanks for the quick response and great help!