Click to See Complete Forum and Search --> : [RESOLVED] how2 spawn new html page with info
jwzumwalt
12-11-2008, 08:34 PM
I would like to have a help/about information html form spawn from my perl program (without the need for a second cgi or perl file. I would prefer to have a new form open up without disturbing the parent browser window. Like a dialog box on steroids.
I have investigated javascript dialog boxes but they are limited in size and lack html formatting or line control i.e breaks. (Yes, I have tried "\n" but this no longer works with current javascript compilers)
Any suggestions? - Thanks for the help
FYI
I have created a cgi directory listing program and don't want to make the user have to browse away from the listing. A sample of this lister is located at...
www.perl.neatinfo.com
You will see that I have a small "about" javascript button at the bottom. I would prefer to supply a table of contents and substantial other setup information.
Sixtease
12-12-2008, 04:08 AM
Please tell me which JavaScript engine doesn't expand "\n"s? That sounds really weird.
I suggest you give JavaScript one more chance. This looks like a job for it. You could for example create a <div> (or have it prepared but hidden) and show it on click. In there, you can have any formatting you like. If you don't mind a few extra kilobytes to your page, I suggest you look at jQuery (http://docs.jquery.com/).
jwzumwalt
12-12-2008, 04:24 PM
The options you mention are all reasonable. I really had prefered to keep everything as one file and the file size is not an issue. I had expected the documentation to be be more than the program!
Could you point me in the right direction? For example, is there some keywords or tutorial that shows me how to use a <div> with hidden code (and how to make it visable)?
----------------
The following code is how perl would set up the script in html
print qq{
<head>
<SCRIPT LANGUAGE="JavaScript">
function showAlert() { alert('Test\n text'); }
</SCRIPT>
</head>
}; # end of html text
This code will stall until I remove the "\n"
I tried all of perls excapes sequences such as placing the text in "" or /\n etc.
Thanks for the suggestion.. JZ
Nedals
12-12-2008, 05:28 PM
print qq{
<head>
<SCRIPT LANGUAGE="JavaScript">
function showAlert() { alert('Test\n text'); }
</SCRIPT>
</head>
}; # end of html text
Perl interpret the ' \n' as a return thus returning the message in 2 lines.
Try escaping the '\'
function showAlert() { alert('Test\\n text'); }
jwzumwalt
12-12-2008, 08:08 PM
That Worked!!!
This is interesting because the "print qq{" is supposed to be a "literal" print *without* code interpretation!
Nedals
12-12-2008, 08:30 PM
This is interesting because the "print qq{" is supposed to be a "literal" print *without* code interpretation!
print qq{} will inperpolate;
print q{} will not. :)
jwzumwalt
12-13-2008, 04:14 PM
Thanks for all the help. This is what I finally got to work the way I wanted...
<SCRIPT LANGUAGE="JavaScript">
function newWindow() {
info=window.open("","Information","toolbar=yes,scrollbars=yes,width=300,height=300");
info.document.write("<html><head></head><body>hello world</body></html>");
}
</SCRIPT>