Solved

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

Posted on 2009-05-20
8
8,892 Views
Last Modified: 2012-05-07
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
Comment
Question by:egoselfaxis
  • 4
  • 3
8 Comments
 
LVL 1

Expert Comment

by:tyconz_helpdesk2008
ID: 24437014
Hi Yvan,

For closing the Greybox window use:

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

0
 
LVL 1

Expert Comment

by:tyconz_helpdesk2008
ID: 24437063
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
 
LVL 1

Accepted Solution

by:
tyconz_helpdesk2008 earned 500 total points
ID: 24437656
I tried the following on IE8 and it worked for me:

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

Author Comment

by:egoselfaxis
ID: 24441084
Thanks!
- yg
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Expert Comment

by:RandomPixel
ID: 25581397
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
 

Expert Comment

by:RandomPixel
ID: 25647916
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
 

Expert Comment

by:RandomPixel
ID: 25648049
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
 

Expert Comment

by:RandomPixel
ID: 25648186
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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now