www.webdeveloper.com
Results 1 to 10 of 10

Thread: Help create help page on reload

  1. #1
    Join Date
    Nov 2002
    Location
    U.S.A. Illinois
    Posts
    23

    Angry Help create help page on reload

    Trying to create a page that when you click a icon it reload the page but adds code to the page, then click it again and it removes the code. Example Click help icon on page, reloads and help screen is inserted, press help icon again and it disappears

  2. #2
    Join Date
    Nov 2002
    Posts
    631
    You could do this with JavaScript. Maybe like this.

    <a href="www.site.com" onClick="javascript:refresh();">
    <div style="display:none;" onReload="docment.style.display == 'block';">
    Info
    </div>

    On don't know if onReload is a real event handler, but onLoad is.

  3. #3
    Join Date
    Nov 2002
    Location
    U.S.A. Illinois
    Posts
    23
    Thanks, that might work. But I'm really looking for an answer that dose it in perl and cgi

  4. #4
    Join Date
    Nov 2002
    Posts
    631
    I don't know those languages yet. Sorry!

  5. #5
    Join Date
    Nov 2002
    Location
    U.S.A. Illinois
    Posts
    23

    Angry

    That's ok, Maybe someone else will be help. And thanks again.

  6. #6
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    Code:
    #!/usr/local/bin/perl -Tw
    
    use strict;
    use CGI ':standard';
    
    print "Content-Type: text/html\n\n";
    
    print q`
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
      "http://www.w3.org/TR/html4/strict.dtd">
    
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Guestbook</title>
    </head>
    
    <body>
    `;
    
    if ( param('help') eq 'show' ) {
        print '-- HELP SCREEN HERE --<br><a href="script.pl">hide help screen</a>';
    }
    else {
        print '<a href="script.pl?help=show">show help screen</a>';
    }
    
    print q`
    </body>
    
    </html>
    `;

  7. #7
    Join Date
    Nov 2002
    Location
    U.S.A. Illinois
    Posts
    23
    Thanks, I try that.

  8. #8
    Join Date
    Nov 2002
    Location
    U.S.A. Illinois
    Posts
    23
    The script worked, how could you convert it to work with a form and an image button. like this example -

    #!/usr/bin/perl
    use CGI qw(:standard :netscape);

    print header;
    print start_html(-title=>'Blank Page',
    -stlye=>'rel'=>'stylesheet','type'=>'text/css', 'src'=>'###.css'}
    , -class=>'content',
    -onLoad=>"if(#######){########('########')}");
    print start_form({-method=>'post' ,-action=>'blank.cgi' ,
    name=>'help'});
    print table({-width=>'100%'},Tr(td({-valign=>'bottom', -align=>'left' ,width=>'50%'},div({-class=>'page-title'},'#### ### ######!')), td({-align=>'center' ,-width=>'50%' ,-colspan=>'3'}),td({-align=>'center' ,-width=>'50%' ,-colspan=>'7'}), image_button({-name=>'Help' ,-src=>'/images/help.gif' ,-align=>'absmiddle' ,-height=>'17' ,-alt=>'Help' ,-border=>'0' ,class=>'button-context' ,-width=>'17'}))
    );
    print end_form;
    print hr;

    to this

    print header;
    print start_html(-title=>'Blank Page',
    -stlye=>'rel'=>'stylesheet','type'=>'text/css', 'src'=>'###.css'}
    , -class=>'content',
    -onLoad=>"if(######){#######('########')}");
    print start_form({-method=>'post' ,-action=>'blank.cgi' ,
    name=>'help'});
    print table({-width=>'100%'}, Tr(td({-valign=>'bottom', -align=>'left' ,width=>'50%'},div({-class=>'page-title'},#### ### ######!')), td({-align=>'center' ,-width=>'50%' ,-colspan=>'3'}),'TEXT IS PLACED HERE',td({-align=>'center' ,-width=>'50%' ,-colspan=>'7'}), image_button({-name=>'Help' ,-src=>'/images/help.gif' ,-align=>'absmiddle' ,-height=>'17' ,-alt=>'Help' ,-border=>'0' ,class=>'button-context' ,-width=>'17'}))
    );
    print end_form;
    print hr;

    And yes I do know some perl and cgi, i just don' know how to code that kind of condition in

  9. #9
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    If you want to do it with a form then just insert it as a hidden field.

    Code:
    <input type="hidden" name="help" value="show">
    The omit this field if param('help') eq 'show' so in that case when the form is submitted there will be no help value passed.

  10. #10
    Join Date
    Nov 2002
    Location
    U.S.A. Illinois
    Posts
    23
    Thanks, Ill give it a try

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles