Connecting Tech Pros Worldwide Help | Site Map

How to insert a Dynamic Value into a javascript?

Terry
Guest
 
Posts: n/a
#1: Jul 20 '05
I've tried and tried, and thought I had it figured out, but still the
results indicate that I'm wrong.

Help is appreciated. I'm merely trying to grab a value from a form and
insert it into a javascript. Any hints as to what's wrong with the
code below?

Request.form("AMOUNT") as used below does not bring my value into the
javascript (This is related to GoToast ROI Conversion tracking).


<script language="javascript">
<!--

if (typeof(ROIID) + '' != 'undefined')
{
TrackEvent('Sale', request.form("AMOUNT"));
}
//-->
</script>
Lasse Reichstein Nielsen
Guest
 
Posts: n/a
#2: Jul 20 '05

re: How to insert a Dynamic Value into a javascript?


wapro@wapro.com (Terry) writes:
[color=blue]
> I've tried and tried, and thought I had it figured out, but still the
> results indicate that I'm wrong.[/color]
[color=blue]
> Help is appreciated. I'm merely trying to grab a value from a form and
> insert it into a javascript. Any hints as to what's wrong with the
> code below?[/color]

The way to get the value of a form control is:
document.forms['formId'].elements['controlName'].value
[color=blue]
> Request.form("AMOUNT") as used below does not bring my value into the
> javascript (This is related to GoToast ROI Conversion tracking).[/color]

I have no idea what "request.form('AMOUNT')" is supposed to do, or what
the names mean. Is "request" the form id and "AMOUNT" the control name?

In that case, forms don't have a form property, and it sure isn't a
function.
[color=blue]
> <script language="javascript">[/color]

In HTML 4, the type attribute is required (and sufficient), so use
<script type="text/javascript">
[color=blue]
> <!--[/color]

HTML-like comments are not necessary.
[color=blue]
>
> if (typeof(ROIID) + '' != 'undefined')[/color]

You don't need to add '', the typeof operator always gives a string.

/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Closed Thread