• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 9285
  • Last Modified:

Greybox Javascript - need function to close greybox window and reload window that spawned it?

I'm using Greybox on a site I'm developing (ie: http://orangoo.com/labs/GreyBox/) and I need be able to both close the greybox window -- AND -- reload the page underneath it.  How would I go about that?

I have the following, .. but it doesn't seem to be working correctly in IE7.

function closeGreybox() {
    parent.parent.GB_hide();
    parent.parent.reload();
}

Please advise.  Thanks!

- Yvan
0
egoselfaxis
Asked:
egoselfaxis
  • 4
  • 3
1 Solution
 
tyconz_helpdesk2008Commented:
Hi Yvan,

For closing the Greybox window use:

$("#GB_window,#GB_overlay").hide();

0
 
tyconz_helpdesk2008Commented:
Yvan, maybe this will point you in the right direction for reloading...

<form name="form2" method="post" action="/%path%//%program%/" onSubmit="javascript:window.top.location.reload();">  

You can find it from here:
http://www.code400.com/forum/showthread.php?p=23735
0
 
tyconz_helpdesk2008Commented:
I tried the following on IE8 and it worked for me:

function closeGreybox() {
    parent.parent.GB_hide();
    window.top.location.reload();
}
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
egoselfaxisAuthor Commented:
Thanks!
- yg
0
 
RandomPixelCommented:
Can someone tell me exactly how to implement this code please.
Where does this go and how exactly should it be included in my code and how does it get called from GreyBox

function closeGreybox() {
    parent.parent.GB_hide();
    window.top.location.reload();
}

Many thanks,
Houston
0
 
RandomPixelCommented:
function closeGreybox() {
    parent.parent.GB_hide();
    window.top.location.reload();
}

Where does this code go and how do you call it or what calls it? I am not a javascript person So I need a little hand holding if you please.

Thanks,
Houston
0
 
RandomPixelCommented:
I have this in my form code:
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1" onSubmit="closeGreybox();">

and I have this in the head tag:
<script type="text/javascript">

function closeGreybox() {
    parent.parent.GB_hide();
    window.top.location.reload();
}
</script>

It works sometimes but not always. I know that sounds strange but that is the case.

I can not provide  a link as the site is now live and I am trying to get this to work.
0
 
RandomPixelCommented:
Here the code for a page that it does not work on:

<?
session_start();
 require_once("../class/sqlQuery.class.php");

if ($_SESSION['admin']<1)
{
header("Location: index.php");
exit();
};





if ($_POST["edit"]=="Edit") {

$qry->queryExecute("UPDATE `category` SET  name='". mysql_real_escape_string($_POST["name"])."' WHERE id = $_GET[id] ");
$complete = 1;
};
$data=$qry->querySelectSingle("SELECT * FROM `category` WHERE id='$_GET[id]'");


?>
<head>
<script type="text/javascript">

function closeGreybox() {
    parent.parent.GB_hide();
    window.top.location.reload();
}
</script>
</head>
<link type="text/css" rel="stylesheet" href="dhtmlgoodies_calendar/dhtmlgoodies_calendar.css?random=20051112" media="screen"></LINK>
      <SCRIPT type="text/javascript" src="dhtmlgoodies_calendar/dhtmlgoodies_calendar.js?random=20060118"></script>

<form id="form1" name="form1" method="post" action="" onSubmit="closeGreybox();">
<table>
  <tr>
    <td >Name of Category</td>
    <td >
      <label>
        <input name="name" type="text" id="name" value="<?= $data['name'];?>" />
        </label>    </td>
  </tr>
  <? if ($data['type'] == 3) { ?><? }; ?>
 <? if ($data['type'] == 2) { ?><? }; ?>
  <? if ($data['type'] == 1 or $data['type'] == 2) { ?> <? }; ?>
 
  <tr>
    <td  colspan="2">
      <div align="center">
        <label>
       
        <input type="submit" name="edit" id="edit" value="Edit" />      
        </label>
      </div></td>
    </tr>
  <tr>
    <td  colspan="2"><? if($complete == 1) echo '<div align="center">Updated!</div>';?></td>
  </tr>
</table>
</form>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now