in reply to Perl Title Help
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:
which produces this output:#!/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, in turn, renders as (complete with tooltip if you hover over 'good' for a bit):<!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>
appone, pr2two, sla_three, 20131015, fail ap2, pr3, sla4, 20131015, good
hth
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl Title Help
by Anonymous Monk on Oct 16, 2013 at 08:59 UTC |