Assign Javascript value

Results 1 to 2 of 2

Thread: Assign Javascript value

  1. #1
    Join Date
    Dec 1969

    Default Assign Javascript value

    Hi,<BR><BR>Is it possible to assign a JavaScript text value to an ASP variable.?<BR><BR>whats the syntax to achieve that.<BR><BR>i know, it works the other way..<BR><BR>thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: Assign Javascript value

    yes...<BR><BR>it&#039s a two-way street... you use hidden form fields both ways...<BR><BR>js to asp -&#062;<BR>use js to update the value in the hidden form field. when the form is posted, use request.form in asp.<BR><BR>asp to js -&#062;<BR>use asp to build a hidden form field into the page with a predetermined value:<BR>&#060;input type="hidden" value="the string I want to use in js:&#062;<BR><BR>as an example of the first method, i have a form which uses dhtml to allow a user to submit multiple rows of data (as many or few as they wish to submit).<BR><BR>it looks like a little like this:<BR>-----------------------------------<BR>Item &#124 Quantity &#124 Est. Price &#124 Term<BR><BR>____ ________ __________ ____<BR><BR>(Add New Row) &#124 (Delete Last Row)<BR>-----------------------------------<BR><BR>Item, Quantity, etc., are column headers. the ________&#039s are text or drop-down inputs.<BR><BR>if the user clicks on Add New Row, a new line of inputs is add beneath the first one. "Delete Last Row" should be obvious.<BR><BR>now, i have a hidden input named "NumRows" on the page. every time someone clicks on "Add New Row", the js updates the value in NumRow (NumRow.Value=NumRow.Value + 1). The opposite occurs if they hit "Delete".<BR><BR>when the form is submitted i use Request.Form("NumRows") to pass the number of rows into my ASP script so it knows how many rows it needs to process...<BR><BR>hth<BR><BR>kurt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts