Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: changing title of a webpage dynamically

by sundialsvc4 (Abbot)
on Jun 05, 2013 at 00:05 UTC ( #1037078=note: print w/ replies, xml ) Need Help??


in reply to changing title of a webpage dynamically

If you want to change the title “and such” using buttons, then it is extremely probable that you will need to use JavaScript to do that.

You see, the only time that the server (i.e. Perl) would become involved, is when there is a “round-trip” involved:   the client makes an HTTP GET or POST to the server, and server replies with an HTTP response.

Most likely, everything that you want to happen ... happens entirely on the client side, start to finish.   As the most-simple example, the button could contain a onclick= handler which runs a bit of JavaScript code that changes, say, the window.title (in the browser’s own DOM model).   When the JavaScript code does that, the browser obediently repaints the screen.   The server, meanwhile, has nothing to do with it.


Comment on Re: changing title of a webpage dynamically
Re^2: changing title of a webpage dynamically
by tejas (Initiate) on Jun 05, 2013 at 15:13 UTC

    i just had an idea but not sure if it is practical...

    but can i call a cgi script recursively from itself??? is it possible to do that???

      Ok guys i think i have found one solution to my problem :D

      i called my own scribt back again. i have done it for only i button but it seems to be working :D

      the link http://www.cgi101.com/learn/ given by toolic helped me, thanks.

      so any other solutions apart from this one??

      #!/usr/bin/perl -w use CGI qw(:all) ; my $today; my $thismonth; my $thisyear; chomp($today = `date +"%-d"`); chomp($thismonth = `date +"%-m"`); chomp($thisyear = `date +"%Y"`); my $cal; my $dir; $cgi = CGI->new; $dir=$cgi->param("dir"); if($cgi->param("today") && $cgi->param("thismonth") && $cgi->param("th +isyear")) { if($dir eq "back") { $today=$cgi->param("today"); $today=$today-1; } } print $cgi->header,$cgi->start_html("$today.$thismonth.$thisyear"); print<<HTML; <table border=1> <tr> <td><form name="input" action="date.cgi" method="POST"> <input type="hidden" name="today" value="$today"> <input type="hidden" name="thismonth" value="$thismonth"> <input type="hidden" name="thisyear" value="$thisyear"> <input type="hidden" name="dir" value="back"> <input type="submit" value="Yesterday"></td> </form> <td>$today</td> <td>$thismonth</td> <td>$thisyear</td> <td><button type="button">Tomorrow</td> <td><button type="button">Set Title</td> </tr> </table> HTML print $cgi->end_html;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1037078]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2014-11-28 11:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (196 votes), past polls