SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript Solution?

    I have an ASP script that loads with initial values for several different fields for a Javascript calculator. It is set up so when a visitor clicks the 'Calculate' button, it submits the results via e-mail then reloads the same page. I can get it to enter the visitor's values in textboxes that are empty, but the default values in the external .js file are replacing what the visitor enters, so they can't see the calculation.

    Here's an example of the code I'm using:

    .js file:



    code:--------------------------------------------------------------------------------
    function initialValues(){
    document.costForm.Week.value="4.00"
    }
    --------------------------------------------------------------------------------


    .asp file:


    code:--------------------------------------------------------------------------------
    TOP
    <%
    Week2=request.form("Week")
    %>

    INSIDE HTML
    <input type="text" name="Week" style="text-align:right;" size="5" value="<%=Week2%>">--------------------------------------------------------------------------------


    Can somebody tell me how I can make the Javascript so it won't replace the value the visitor entered if the number is different from the initial value?

    Something like:

    detect if the value is 4.00

    if so enter initial value

    if not do not enter initial value


    Any help would be greatly appreciated.

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    TOP
    <%
    Week2 = Request.Form("Week")
    If Week2 = "" Then
    Week2 = "4.00"
    End If
    %>


    (This is no Java, Cold Fusion and More question, it's not even javascript...)
    Last edited by jofa; Jun 19, 2002 at 13:32.

  3. #3
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Welcome JohnSaunders...

    Please make sure you look through the forums to post in the correct location. This is a javascript question and as such belongs in the javascript forum.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  4. #4
    I'm a college yuppie now! sbdi's Avatar
    Join Date
    Jul 2000
    Location
    Dublin , Ireland
    Posts
    1,271
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah ya friggin retard!!!
    Back Again


Bookmarks

Posting Permissions

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