Jump to content

Archived

This topic is now archived and is closed to further replies.

Jim from Oakland

link shows window, window content sent as a string

Recommended Posts

Javascripters

I'm not familiar enough with javascript to hack even
this most basic need: I've got a php app and I hope to add
help that is shown in a separate window when user clicks on
a link (or button, if that helps).  But, I want to send a string
to the window as content, instead of specifiying a file (which
I know how to do).

Thanks a lot.

Share this post


Link to post
Share on other sites
Why not use a mixture of PHP and JavaScript?

[code]<input type="button" onclick="window.open('help.php?content=whatever');" />

/* On the help.php popup */
<?php
if(isset($_GET['content'])) {
    switch($_GET['content']) {
        case "abc" :
            echo "page content";
            include("relevant_file.html");
            break;
    }
}
?>
[/code]

Share this post


Link to post
Share on other sites
I hope to avoid the need for a file to
"populate" the help window.

I really want to open a new window (for help) and
put the help content/message into the window
when a user clicks a link or if necessary a button.

If I have to use a simple js function in <head> that is
fine, buttons are ok too.

pseudo(lameo)code

<head>
<script language="javascript">
function hlpWin($pContent='')
{
  var $Name = 'Help';
  var hlpWin = window.open('',$Name,height=200,width=200);
  hlpWin.write($pContent);
}
</script>
</head>

<a onClick=hlpWin("<b>Help</b> for item 1 is on the way...")>Help 1</a>

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.