How to insert a Dynamic Value into a javascript?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Terry

    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("A MOUNT") as used below does not bring my value into the
    javascript (This is related to GoToast ROI Conversion tracking).


    <script language="javas cript">
    <!--

    if (typeof(ROIID) + '' != 'undefined')
    {
    TrackEvent('Sal e', request.form("A MOUNT"));
    }
    //-->
    </script>
  • Lasse Reichstein Nielsen

    #2
    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("A MOUNT") 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="javas cript">[/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/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    Working...