Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a background image to show up in a cgi script

Status
Not open for further replies.

shamrox

Programmer
Sep 27, 2001
81
US
I am not having any luck getting a backgroud image to show up in this script I'm using/writing. I can change the background color with out a problem, but when I put in code for the bg image, it doesn't show up. Can anyone help me?

I'm sure I've left off crucial info, so just let me know what else you might need to help me solve this most likely easy situation.

Thanks.
 
This piece of CGI will produce the HTML that follows it.

Code:
#!/usr/local/bin/perl -T
use strict;
use CGI;

my $cgi = new CGI;
$keywords = 'keyword1 keyword2 keyword3';
$description = 'Some Descriptive text here';
$css = '[URL unfurl="true"]http://url/to/a/style_sheet.css';[/URL]

print $cgi->header,
	$cgi->start_html(-style=>{'src'=>$css},
			-BGCOLOR=>'#ffffff',
			-background=>'[URL unfurl="true"]http://server.com/images/picture.gif',[/URL]
			-title=>'Caribbean Islands z39.50 Metadata Search Interface',
			-meta =>{'keywords'=>$keywords,
					 'description'=>$description}),		
			'<center><table width=&quot;600&quot; border=&quot;0&quot;>';

HTML OUTPUT of the code above.
Code:
<html xmlns=&quot;[URL unfurl="true"]http://www.w3.org/1999/xhtml&quot;[/URL] lang=&quot;en-US&quot;>
  <head>
    <title>Caribbean Islands z39.50 Metadata Search Interface</title>
      <meta name=&quot;description&quot; content=&quot;z39.50 search 
        interface written in Perl using CNIDR Isite zclient&quot; />
      <meta name=&quot;keywords&quot; content=&quot;z39.50 metadata search&quot; />
      <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;[URL unfurl="true"]http://url/to/a/style_sheet.css&quot;[/URL] />
  </head>
<body background=&quot;[URL unfurl="true"]http://server.com/images/picture.gif&quot;[/URL] bgcolor=&quot;#ffffff&quot;>
<center>
<table width=&quot;600&quot; border=&quot;0&quot;>


You could do the same just by printing the HTML. If your background is
not showing up, you probably need to fully qualify the location of the src. 'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top