haha no, i was very unclear apparently. the calculations aren't done client-side; the formatting (regex) is though; the URL is static, i want it to to say
http://www.yahoo.com/cgi-bin/perl.cgi? i just want the price to be reformatted from $1.99 to 1.99, for example. or from jkadhsjaa$.99 to .99, if you see what i'm doing. (stripping all but numbers and dots from price variable) the transaction is already processed, all that the user could fool with is a secondary logging system (i mean, if they feel that they have the spare time to fool a survey system, more power to them.) i just want to get the variable that i've regexed to appear within a tag like:
<IMG SRC="http://www.google.com/perl.cgi?amount=newstr"> just that, and nothing more.
to be more concise, this is exactly what i want it to do:
<SCRIPT LANGUAGE="JavaScript">
var re = /([^\d\.]+)/g;
var str = "FINAL_SUBTOTAL";
var newstr = str.replace(re, "");
<IMG SRC="https://www.google.com/perl.cgi?amount=newstr">
</script>
see what i'm trying to do? just making the "newstr" value be automated; i just can't figure out how javascript returns (actually, writes) a variable to a page.
in perl, i'd be doing this:
my $str = $other_scripts_input;
my $newstr;
$newstr =~ s/([^\d\.]+)/g;
print "<img src=\"http://www.someurl.com/perl.cgi?amount=$newstr\">";
but as i've said, i've not been given the time (at the moment) it takes to modify someone else's brainchild ):
i do appreciate all help given.
(you see, this is really a temporary workaround until i'm granted the time to modify their perl script and do it the right way)
strfry
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.