Created
January 10, 2009 01:59
-
-
Save nobuhito/45347 to your computer and use it in GitHub Desktop.
入力された漢字を拡大して表示
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use CGI; | |
use Template; | |
use HTML::Prototype; | |
use utf8; | |
my $query = CGI->new; | |
$query->charset('utf-8'); | |
my $tt = Template->new; | |
my $template = show_template(); | |
my $stash; | |
$stash->{prototype} = HTML::Prototype->new; | |
$stash->{s} = $query->param('s'); | |
print $query->header(-type => 'text/html', -charset => 'UTF-8'); | |
$tt->process(\$template, $stash); | |
sub show_template { | |
return <<'TEMPLATE'; | |
[% SET title = "文字拡大" -%] | |
<html> | |
<head> | |
<title>[% title %]</title> | |
<style> | |
body,input { font-size: 14px; font-family: trebuchet MS } | |
input { background: #fff } | |
span { font-size: 1.6em; margin-right: 1em; } | |
h2 { font-size: 1.2em } | |
#wide_string { font-size: 6em; font-family: serif } | |
</style> | |
[% prototype.define_javascript_functions %] | |
<script> | |
function doWide() { | |
$('wide_string').innerHTML = $('from').value; | |
} | |
function focus4input() { | |
Field.select('from'); | |
} | |
</script> | |
</head> | |
<body onLoad='focus4input()'> | |
<span>[% title %]</span> | |
<input id='from' type='text' onKeyup='doWide()' value='[% s %]'> | |
<div id='wide_string' >[% s %]</div> | |
</body> | |
</html> | |
TEMPLATE | |
; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment