> The following code is live at http://www.biblescramble.com/Esther/x.cgi.
> I want to put newlines where the tabs are in $insert=" Hazel Work
states:
WY relocate: No";
> I've tried <br>, \n, etc. What do I need?
Not sure what you're after, exactly. Perl will replace tabs by:
$insert =~ s/\t+/xxx/g;
I"m using "\t+" (one more tab chars) in case you've got tab tab tab and
don't want 3 new lines - browsers will display new lines w/ <BR> so [1]:
$insert =~ s/\t+/<br>/g;
if you want to do it in the 'testing' java script function, its a little
different.
$script2="function tester(){testing=\"";
$script2.=$insert;
$script2.="\"; var head1 = document.getElementById(\"head1\");
head1.firstChild.nodeValue=testing; return false;}";
java script has an RE package, which comes w/ the string object and a
replace method,
http://www.devguru.com/technologies/ecmascript/QuickRef/string_replace.html
Note, using single quotes (as you've got no perl var being "interpolated)
will avoid the escapes of all you dbl quotes, so something like:
$script2 = 'function tester(){testing="';
$script2 .= $insert;
$script2 .= '";
var test_regex = /\t+/g;
var result = testing.replace(test_regex, "<br>\n");
var head1 = document.getElementById("head1");
head1.firstChild.nodeValue = result;
return false;}';
Untested, YMMV but that's the idea.
a
[1]
as a human readability issue, I always add a \n to "<Br>" tags (and <P>
tags etc, so when you view source, its more legible:
$insert =~ s/\t+/<br>\n/g;
Andy Bach
Systems Mangler
Internet: [EMAIL PROTECTED]
VOICE: (608) 261-5738 FAX 264-5932
"So it goes ...."
Kurt Vonnegut, Jr. (November 11, 1922 ? April 11, 2007)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs