gpt4 book ai didi

javascript - 1 javascript/css 问题 2 perl cgi 问题

转载 作者:行者123 更新时间:2023-11-27 22:32:00 29 4
gpt4 key购买 nike

Javascript CSS 问题:

我正在使用一个文本框来写入一个 div。我使用以下 javascript 获取文本框来执行此操作:

<script type="text/javascript">

function process_input(){
document.getElementById("description").innerHTML = document.getElementById("message").value;
return true;
}
</script>

我将 div 样式设置为具有 white-space:pre-wrap,它在 Firefox 中有效,但在 IE 中无效。有谁知道 css 规则或一些额外的 javascript 使 div 反射(reflect)在文本框中输入的回车符也被输入到 div 中?

我正在研究 perl cgi 脚本,其他人开始将使用背景图像的文本作为电子贺卡发送。这是 perl cgi 脚本:

#!/usr/local/bin/perl5

use CGI;
use GD;
use CommonSubs;
use DBI;

use dbInfo;

$q = new CGI;


$userInfo= &CommonSubs::DirInfo($userId);

$user = $ENV{'REMOTE_USER'};
$from = $q->param('from');
$to = $q->param('to');
$cc = $q->param('cc_manager');
$card = $q->param('card');
$message = $q->param('message');



my %availableCards = ("card1" => "large_card_1.jpg",
"card2" => "large_card_2.jpg",
"card3" => "large_card_3.jpg",
"card4" => "large_card_4.jpg",
"card5" => "large_card_5.jpg",
"card6" => "large_card_6.jpg",
"card7" => "large_card_7.jpg",
"card8" => "large_card_8.jpg",
"card9" => "large_card_9.jpg");

my $cardToUse = $availableCards{$card};
my $emailContent = "";

$text = $message;
@lines = split(/\n/, $text);
$lCnt .= $#lines+1;
$lineStart = 80;
$lineHeight = 24;



$container = "..../root-wwwin/htdocs".$cardToUse;
$font = "....verdana.ttf";




$image = GD::Image->newFromJpeg($container);


$txtColor = $image->colorResolve(0,0,0);

for ($i=0; $i<$lCnt; ++$i){
$xPos = 375;
$yPos = $lineStart + ($lineHeight*$i);
@bounds = $image->stringTTF($txtColor,$font,13,0,$xPos,$yPos,@lines[$i]);
}


$ts = time();
$imgFile = "ecard_".$user."_".$ts.".jpeg";

open(IMGFILE, "...$imgFile");
binmode IMGFILE;
print IMGFILE $image->jpeg;
close (IMGFILE);

$img = "<img border=0 src=\"...$imgFile\" />";

$emailContent = <<HTML;


$card


HTML


&CommonSubs::sendEmail("$to\@xxx.com","$from\@xxx.com","$cc\@xxx.com", "","$bcc\@xxx.com",$emailContent);

print "Content-type: text/html\n\n";
print "$img";
print "ecard sent";

我需要的是 perl cgi 代码,当它通过 sendmail 发送时,使文本环绕在用作 html 背景的图像之上。

预先感谢您的帮助。

最佳答案

预包装替代品:

.wordwrap {  
white-space: pre-wrap; /* css-3 should we be so lucky... */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 ?? */
white-space: -o-pre-wrap; /* Opera 7 ?? */
word-wrap: break-word; /* Internet Explorer 5.5+ */
_white-space: pre; /* IE only hack to re-specify in addition to
word-wrap */
}

关于javascript - 1 javascript/css 问题 2 perl cgi 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3519359/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com