Jump to content

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.
Link to comment
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]
Link to comment
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>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.