in reply to Re: show a message only during the sleep time
in thread show a message only during the sleep time

hi davidrw

I tried your trick,
but I still have "pls wait !" on the screen and will not vanish:
................................... print "<body bgcolor='#c0c0d0'>\n"; print "<center>"; print "<p><br></p>"; print "<p><br></p>"; print "<div> pls wait ! </div>\n"; print "<SCRIPT LANGUAGE = \"JavaScript\">\n"; print "<!-- \n"; print "<body onLoad="...">\n"; print "// -->\n"; print "</SCRIPT>\n"; ...................................

Replies are listed 'Best First'.
Re^3: show a message only during the sleep time
by davidrw (Prior) on Jul 24, 2005 at 16:27 UTC
    Well, you have write the "..." javascript -- the elipsis was just a place holder (and note that we want to add javascript code by using the <body onLoad=""> attribute, NOT embed the body tag inside script tags). Also, note the clunkiness of print statements for this.. (and this is pretty general advice) at the minimum, at least use here-docs, and also keep in mind a more robust solution like Template::Toolkit or HTML::Template. So, back to the problem at hand, this is what i was envisioning:
    print <<EOF; <html> <head> <title>ntop startup script</title> <STYLE TYPE='text/css'> h3 { color: red } a { text-decoration: none; font: bold 14pt/16pt Ariel, serif } a:hover { color: red } /* when mouse is over link */ </style> <script language="javascript"> function hideWaitMsg(){ var obj = getElementById('wait_msg_text'); obj.visible = false; } </script> </head> <body bgcolor='#c0c0d0' onLoad="hideWaitMsg()"> <center> <p><br></p> <p><br></p> <div id="wait_msg_text">pls wait, ntop will be started</div> EOF
    That's the basic setup .. note that i just guessed at the javascript code in the hideWaitMsg() function -- that part is left as an excercise for the reader.
      thanks a lot !

      but I get:
      Software error: Can't find string terminator "EOF" anywhere before EOF at /usr/local/w +ww/cgi-bin/ntop/ntop4.cgi line 20.
      my system has a problem with this line:
      print <<EOF;

      I have:
      # pkg_info | grep perl mod_perl2-2.0.1,2 Embeds a Perl interpreter in the Apache2 server perl-5.8.7 Practical Extraction and Report Language
      do I need to install additional perl module ?
        well, obvious question is, do you have a 'EOF' line in your code? :) Note that the string "EOF" is arbitrary, too. Search for "here-document" in perldoc perldata for more info, but two simple examples:
        print <<EOF; Hello World !!! EOF print <<BLAH; Hello World !!! BLAH
        If you still have problems, please post the code along w/the error message.