Welcome to WebmasterWorld Guest from 54.159.179.132

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Dynamic Generated Page---Hide/Unhide TS

   
12:50 am on Nov 28, 2008 (gmt 0)

5+ Year Member



I have a Perl script which generates the Web Page and its dynamic. Here is my perl script:
!/usr/bin/perl
#
#
# Modified by :
# Modified Date :

use warnings;
use strict;
use Socket;

( my $pgm = $0 ) =~ s{ \A .* / }{}xms;

my $data = {};
my $host = ();
my $poolold = ();

my $POOL_NAME_WIDTH = 30;
my $IP_ADDRESS_WIDTH = 15;

LINE:

open(SMP, "/usr/bin/snmpwalk -c test -v 2c X.X.X.X F5-BIGIP-LOCAL-MIB::ltmPoolMemberStat grep -v -i integer grep -v -i mail grep -v -i syslog ") die "Failed: $!\n";

while ( <SMP> ) {
chomp;
my $line = $_;

$line !~ m{ \S }xms and next LINE;

if ( $line !~ m{
\A
F5-BIGIP-LOCAL-MIB::\w+ [.]
" ( [^"]+ ) "
[.] ipv4 [.]
" ( [^"]+ ) "
}xms
)
{
warn "$pgm: warning: can't parse line: $line\n";
next LINE;
} # if

my (
$pool,
$ip_address,
) = (
$1,
$2,# HTMP Page Display

print "Content-type: text/html\n\n";

print <<ENDOFHTML;
<HTML>
<HEAD>
<TITLE>DashBoard</B></CENTER></TITLE>
<BODY background="/icons/page-background.png">
<body text="#808080">
<IMG SRC="/icons/tst.gif" width="142" height="60" align="left">
<h1 align="center" font size=1> SNMP Page</center></h1>
<br>
<br>
</HEAD>
</HTML>
ENDOFHTML

print "<table border=1>";
print "<tr>";
print "<th>Pool Name</th>";
print "<th>Member</th>";
print "</tr>";

for my $pool ( sort keys %$data ) {
for my $ip_address ( sort keys %{ $data->{ $pool } } ) {
my @numbers = split /\./, $ip_address;
my $raw_ipaddr = pack("C4", @numbers);
$host = (gethostbyaddr($raw_ipaddr, 2))[0];
# printf "%-${POOL_NAME_WIDTH}s %${IP_ADDRESS_WIDTH}s\n\n",
# $pool,
# $host;
# print "<br>\n POOL Name:$pool , Members: $host<br>\n";

if ( $poolold ne $pool ) {
$poolold = $pool ;
}else{
$pool = () ;
}

print "<tr>";
print "<td>$pool</td>";
print "<td>$host</td>";
} # for
} # for

print "</tr>";
print "</table>";

-------->My output is:

Pool Members
a 1
2
3

b 4
5

....

Hence how can I hide members and unhide them when mouse is over Pool i.e. a or b...

Note: The output is Pool is a and members are 1,2,3 and So forth.....In this message its looks like 2 and 3 are Pool and its not aligning the members under members heading.

Thanks

12:08 pm on Dec 1, 2008 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld [webmasterworld.com], manik112!

this isn't really a perl issue.
you could use css to add a hover pseudo-class to the Pool column elements and use that to control the visibility of the Members column elements.

you have some problems with the html you are outputting.
there are two body tags and no closing body tag and several displayable inline elements in the head of the document.
the table should be within a body tag, which should be after the head but before the closing html tag.
this may render correctly on some browsers but it won't validate.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month