SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Evangelist BJ Duncan's Avatar
    Join Date
    Jun 2007
    Location
    North Richmond
    Posts
    495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    NOOB to javascript please help

    G'day to all,

    Sorry if this appears lame but I am a NOOB (scared) of javascript and try to avoid it at all costs, however, I am trying to dip my toes in to see how I go
    <!-- end of pity story -->

    Anyways,
    I am trying to do a confirmation popup. I have looked at the many scripts out there and can use it in general, what I would like is to have get values for the window.location.

    E.g.:
    Code JavaScript:
    function go_there()
    {
     var where_to= confirm("Do you really want to continue with Payment??");
     if (where_to== true)
     {
       window.location="https://www.duncanmedia.com.au/advertiser.php?page=purchase&view=make_purchase";
     }
     else
     {
      window.location="https://www.duncanmedia.com.au/advertiser.php?page=purchase&view=checkout";
      }
    }

    This doesn't appear to be working. Is this because of the:
    ?page=purchase&view=make_purchase
    section?

    Does the url have to be a full page? E.g.: http://www.duncanmedia.com.au/advertiser.php

    Any assistance (simple remember I'm a noob) would be very much appreciated.
    Regards,
    BJ Duncan

  2. #2
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It works for me, nothing wrong here. How do you call the go_there() function?
    I'm creating trouble-free Apache, PHP, MySQL installer, WITSuite,
    and use it to setup my development environment.
    Demo, support, contact. Questions?

  3. #3
    SitePoint Evangelist BJ Duncan's Avatar
    Join Date
    Jun 2007
    Location
    North Richmond
    Posts
    495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have the script in the head section of the html, then I have a button within the body section I have a a submit button with an onClick() function.
    Regards,
    BJ Duncan

  4. #4
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, could you create a stand-alone small HTML with this script and post it here - just to review and test it.
    I'm creating trouble-free Apache, PHP, MySQL installer, WITSuite,
    and use it to setup my development environment.
    Demo, support, contact. Questions?

  5. #5
    SitePoint Evangelist BJ Duncan's Avatar
    Join Date
    Jun 2007
    Location
    North Richmond
    Posts
    495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your assistance alex.w

    I have chickened out and taken the php option.

    Sorry for your troubles, but disregard. One day I will grow some balls and tackle this hurdle I have. Unfortunately, time is not permitting me to get right into it now.

    Again, thanks for taking the time to respond.
    Regards,
    BJ Duncan

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    That's alright. You may have taken the smarter route there, for you should have the server solution working first before duplicating the task from javascript to reduce the number of page accesses.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •