Connecting Tech Pros Worldwide Help | Site Map

How to insert a Dynamic Value into a javascript?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 12:00 PM
Terry
Guest
 
Posts: n/a
Default How to insert a Dynamic Value into a javascript?

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>

  #2  
Old July 20th, 2005, 12:00 PM
Lasse Reichstein Nielsen
Guest
 
Posts: n/a
Default 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.'
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.