So your greybox window appears with content then?  I'm not quite sure
if it does from your posting.  If not, I've got some FAQs on that at
http://www.malthusian-solutions.com/ms/index.php?q=node/6.

What browser/OS combination are you using?

My own personal preference is to create functions in the main page for
greyboxes to call rather than access the main elements directly.  That
way you don't have to worry about changing an ID or if you decide
later you need to do data validation or  massage the variable (perhaps
you need to add 'id' to the front of it or something).  Also, it
definitely helps with debugging, in my experience.

In your main page I would have:
function getOwnCode() {
  var e =document.getElementById('txtOwnCode');

  return e ? e.value : "";
}

Also, document.write usually won't do anything useful in a function
that is called from onLoad.  You need to call it when the page is
still rendering:

<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title>Template content Preview</title>
<link rel='stylesheet' type='text/css' href='layout/styles.css' />
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
</head>

<body>
<script  type='text/javascript'>top.getOwnCode();</script>
</body>
</html>

I keep nearly all of my javascript in top (in the page header
include), so I use it instead of parent.parent.

Hope that helps!
--
Tyler Style
http://nirdvana.com
http://malthusian-solutions.com


On Jan 10, 7:51 am, "[email protected]" <[email protected]>
wrote:
> Hello!
>
> I'm having difficulties capturing a variable from the main window when
> loading Greybox.
>
> I've read a bunch of posts on this topic, and have come up with the
> following:
>
> MAIN WINDOW
> <a href="preview_content.php" id="txtOwnCode" onclick="return
> GB_showCenter('Preview Message', this.href)"><img src="images/
> preview_button_own_code.gif" border="0"></a>
>
> The ID reference is used elsewhere on the page to identify content
> entered into a generic text box. This is the content I need to be
> displayed in GREYBOX. So here's the code for the above-referenced
> preview_content.php script - the script that loads in Greybox:
>
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head>
> <title>Template content Preview</title>
> <link rel='stylesheet' type='text/css' href='layout/styles.css' />
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1" />
> <script>
> function LoadContent(){
>     var content = parent.parent.document.getElementById
> ("txtOwnCode").value;
>     document.write(content);
>
> }
>
> </script>
> </head>
> <body onload="LoadContent();">
> </body>
> </html>
>
> I tried swapping out the <body onload.... stuff with the
> AJS.AEV(window, 'load', function() {
>    ...
> based on many previous posts, but can't seem to get that working
> either...
>
> Any specific help would be fantastic - I'm a newbie!
>
> Thanks,
>
> John
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"GreyBox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/greybox?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to