Jump to content


Photo

link shows window, window content sent as a string


  • Please log in to reply
2 replies to this topic

#1 Jim from Oakland

Jim from Oakland
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 03 July 2006 - 11:42 PM

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.


#2 Gast

Gast
  • Members
  • PipPipPip
  • Advanced Member
  • 131 posts
  • LocationSouth East England

Posted 04 July 2006 - 12:12 PM

Why not use a mixture of PHP and JavaScript?

<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;
    }
}
?>

OS and Internet Specs:
Windows XP (with SP2), 1680x1050, PHP 4, MySQL 3, Internet Explorer 6 &7 /FireFox 2.0/Opera 9.2

Tutorials:
Simple Introduction to AJAX and XMLHttpRequest
Creating Live Data with AJAX Making a Google Suggest like application

#3 Jim from Oakland

Jim from Oakland
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 04 July 2006 - 06:07 PM

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>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users