What about the user says :

<body
text="#123456"
bgcolor="#aabbcc"
>
or
<body bgcolor='#123456'>
or
<body bgcolor=
"red">

Anyway, the bgcolor can be formed or change again via javascript or CSS.
I mean, blocking bgcolor in body tag cannot solve your potential problem.

But you may find someway to put this in your body tag :
background="white_block.jpg",
as wallpaper goes upper than bgcolor or using javascript :
document.bgColor='ff0000'; // not sure if this run on NS too

In  Perl way, I can't provide any code here because I don't know when you
want to
block that bgcolor .. On the print time ? or at the html file's landing
time...

Anyway, if you just don't want your users to use bgcolor in the body tag,
just simply $line =~ s/bgcolor/whatever_you_like/;

Once the browser don't understand something not in list of its properties,
will be ignored... I mean, don't care on the RHS of =, but the LHS, unless,
you are trying to fulfill W3C's html standard.

Regards,
Perl Beginner

> no, the problem is on the other side of the "=" token
>
> eg:
> <body bgcolor="#999999">
> or
> <body bgcolor=red>
> or
> <body bgcolor="red">
>
> and he would like to make that
>
> <body>
>
>
> I would of course go with say:
>
> #------------------------
> #
> sub un_colour {
> my ($line) = @_;
>
> $line =~ s/\s*bgcolor=("?)([^">\s]+)("?)//gi ;
>
>     $line;
>      } # end of un_colour
>
>
> since the middle element needs to guard against
>
> a. "
> b. >
> c. white space
>
> ciao
> drieux
>
> ---
>
>
> my $l1 = '<body    bgcolor="#999999" other="fred">
> stuff here
> <table bgcolor=blue>
> ';
> my $l2 = '<body bgcolor=red other="fred">';
> my $l3 = '<body bgcolor="red" other="fred">';
>
> foreach my $tag ( $l1 , $l2 , $l3 )
> {
>
> my $answer =  un_colour($tag);
>
> print "#-----------\n$answer\nfor $tag \n";
> }
>
> #------------------------
> #
> sub un_colour {
> my ($line) = @_;
>
> $line =~ s/\s*bgcolor=("?)([^">\s]+)("?)//gi ;
>
> $line;
>
> } # end of un_colour
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to