PDA

View Full Version : DHTML widget Hide command



thunderai
04-19-2013, 11:23 PM
1) Script Title: DHTML Widget

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/

3) Describe problem:

I want to do:



<?php

if (!isset($_POST["bypassdash"])) {
// Not set display it
$displaydash = 1;
} else {
if($_POST['bypassdash'] == 1) {
// Bypass dash is one. DO not display the dash
$displaydash = 0;
} else {
$displaydash = 1;
}
}
if($displaydash == 1) {
?>
<script type='text/javascript'>
var contentpanel_win=dhtmlwindow.open('layouttableiframecontent', 'iframe', 'index_new.php', 'Dash Panel', 'top=<?php echo $array_dash[0];?>px,left=<?php echo $array_dash[1];?>px,width=<?php echo $array_dash[2];?>px,height=<?php echo $array_dash[3];?>px,resize=1,scrolling=1,center=0', 'recal');
</script>
<?php
} else {
?>
<script type='text/javascript'>
var contentpanel_win=dhtmlwindow.open('layouttableiframecontent', 'iframe', 'index_new.php', 'Dash Panel', 'top=<?php echo $array_dash[0];?>px,left=<?php echo $array_dash[1];?>px,width=<?php echo $array_dash[2];?>px,height=<?php echo $array_dash[3];?>px,resize=1,scrolling=1,center=0', 'recal');
contentpanel_win.hide()
</script>
<?php
}
?>


In general it loads the DHTML window and wont hide it. How do I get it to hide it? I want it to load, but in the background if the conditions are met.

How can I do that?

jscheuer1
04-20-2013, 01:45 PM
There is no "in the background" with this script. You either create the window and open it, or you create a link that will create the window and open it. For the one you say you want "in the background" follow the template for Window 4 (Content from a DIV on the page) on the demo page:


<a onclick="divwin=dhtmlwindow.open('divbox', 'div', 'somediv', '#4: DIV Window Title', 'width=450px,height=300px,left=200px,top=150px,resize=1,scrolling=1'); return false" href="#">
<b>Create/ Open Window 4</b>
</a>

Which in your case would be something like:


<?php
} else {
?>
<a href="#" onclick="contentpanel_win=dhtmlwindow.open('layouttableiframecontent', 'iframe', 'index_new.php', 'Dash Panel', 'top=<?php echo $array_dash[0];?>px,left=<?php echo $array_dash[1];?>px,width=<?php echo $array_dash[2];?>px,height=<?php echo $array_dash[3];?>px,resize=1,scrolling=1,center=0', 'recal'); return false;">Open Window</a>
<?php
}
?>

thunderai
04-20-2013, 07:32 PM
Can a hide() event only be called once the page is fully loaded?

jscheuer1
04-20-2013, 10:26 PM
I don't know. Try it without the PHP just to be sure. However, what's the difference? What are you going to do with that DHTML window in the background? Unless you need it there for tracking or something, why not just wait to open it until the user clicks on a link to do so.

If, on the other hand you don't want the user to ever see it, just open up a normal iframe on the page with its visibility hidden

Another thing you could do is launch it normally. Also have a stylesheet on the page that sets the visibility of the main id to hidden with the !important keyword. Then, if and when you want it shown, remove that stylesheet. I'll work out the details later if we need them, gotta run now.