iframe to call iframe

dcass
dcass used Ask the Experts™
on
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

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Lead Developer
Commented:
Something like this?:

<script>
function show(temp)

{
	document.getElementById("content_frame").src = "details.php?tmp1=xxx&tmp2=yyy&tmp3=aaa&tmp4=bbb";
  	document.getElementById(temp).style.display="inline-block";
}

function hide(temp) 

{

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

}
</script>
<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="blank.html" id="content_frame"></iframe>

  </div>

</div>

Open in new window

Author

Commented:
looks like it will.  I'll try it then let u know!

Author

Commented:
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

Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Top Expert 2008

Commented:
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

Author

Commented:
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

Author

Commented:
I think it's the spaces in the v fields.

Author

Commented:
Thanks for the quick response and great help!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial