This has nothing to do with perl. Achieve your goal in HTML/CSS/JavaScript then populate the appropriate values from your perl backend. Consider using a templating option to separate your client side and serve side code. HTML::Template, Template::Toolkit.
| [reply] |
push(@rows,$q->td([$appname, $prname, $sla, $sdate, $stime, $edate,'<F
+ONT COLOR='.$fail.'>'.$etime.'</FONT>','<FONT COLOR='.$fail.'>'.$stat
+us.'</FONT>', '<b title="'.$comment.'">comment</b>']));
| [reply] [d/l] |
Perfect. This is the what I was looking for. Thanks a ton.
I replace with
| [reply] |
You have to use a GUI in order to have a "pop over".
Your code does not drive a GUI, but there are a number
of options with Perl. | [reply] |
OP's statement re html mis-states the character of 'title' as presented in the parent node. The <title>Title goes here</title> tag can appear ONLY in the <head> section.
In this case, <b id="text1" title="A bold text">Hello my friends!</a> 'title' is an attribute of the bold tag. It does produce the tool-tip 'A bold text' even though the html is only partially correct (typo or cut'n'paste error at the </a>):
<b id="text1" title="A bold text">Hello my friends!</a>
Actually, the canonical syntax is (as lifted from w3cschools):
The title attribute is supported in all major browsers. #NB 'attrtibute,' not 'tag'
The title attribute specifies extra information about an element.
The information is most often shown as a tooltip text when the mouse moves over the element.
Differences Between HTML 4.01 and HTML5
In HTML5, the title attribute can be used on any HTML element (it will validate on any HTML element. However, it is not necessarily useful).
In HTML 4.01, the title attribute cannot be used with: <base>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>.
Syntax
<element title="text">
Attribute Values
text A tooltip text for an element
The Perl code supplied also seems to reflect some misunderstandings the way perl interpolates. The following code appears to do what the Seeker desires:
#!/usr/bin/perl
use 5.016;
use warnings;
# 1058272
say '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
say '<html lang="en"><head><title>1058272.htm"</title></head>';
say '<body style="color:black; background-color: white">';
say '<table summary="layout">';
my ($appname, $prname, $sla, $edate, $status);
my $fail = 'red';
my @data = ('appone pr2two sla_three 20131015 fail',
'ap2 pr3 sla4 20131015 good',
);
for $_(@data) {
($appname, $prname, $sla, $edate, $status)= split / /,$_;
print "<tr><td>$appname, $prname, $sla, $edate,";
print "<span title=\"status\"><b> <font color=\"$fail\">$status ";
say '</font></b></span></td></tr>';
}
say '</table>';
say '</body></html>';
which produces this output:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en"><head><title>1058272.htm"</title></head>
<body style="color:black; background-color: white">
<table summary="layout">
<tr><td>appone, pr2two, sla_three, 20131015,<span title="status"><b> <
+font color="red">fail </font></b></span></td></tr>
<tr><td>ap2, pr3, sla4, 20131015,<span title="status"><b> <font color=
+"red">good </font></b></span></td></tr>
</table>
</body></html>
which, in turn, renders as (complete with tooltip if you hover over 'good' for a bit):
| appone, pr2two, sla_three, 20131015, fail |
| ap2, pr3, sla4, 20131015, good |
hth
| [reply] [d/l] [select] |
perfect. But I have all the codes in my cgi script. I just want the help for the specific line I have mentioned in the question.
| [reply] |
Many valid suggestions above, but I think you are looking for this syntax:
$q->b({title=>"$comment"},"comment")
to produce what you want (Leverages the b() method exported by the CGI module).
When in doubt, mumble; when in trouble, delegate; when in charge, ponder. -- James H. Boren
| [reply] [d/l] |
Original parent content:
In the below code, i m showing the value of $comment at the last column of table. Instead of that I want only "comment" to be written and when I will mouseover that I should get the value of $comment in the tooltip or popup. In html we can use title tag for that. How to do that in perl ? my current code:
push(@rows,$q->td([$appname, $prname, $sla, $sdate, $stime, $edate,'<F
+ +ONT COLOR='.$fail.'>'.$etime.'</FONT>','<FONT COLOR='.$fail.'>'.$st
+at +us.'</FONT>', $comment]));
in html this can be done with :
<b id="text1" title="A bold text">Hello my friends!</a>
Please help me with the solution. Thanks in advance !!! | [reply] [d/l] [select] |