Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    alert box in javascript

    hello everyone,
    can anyone please help me build a alert box with the following.

    i have got a basic one which opens when my website is opened but i would like have something like when they click ok button then the offer page opens and when they click cancel then they remain to the same page.

    i have a box on this website if you want to see my work www.rufaspa.co.uk please help on how to do the coding. many thanks

    below is the code i used .
    <html>
    <body>
    <script type="text/javascript">alert('Special Offer\n\nPamper Party Package\nOne Full Treatment + 2 Mini Treatments \n\nOnly £15* Each Person \n\n Book Now Email:- info@rufaspa.co.uk Call :- 07799 670 973 \n\n\n Check out our Special offer List on www.rufaspa.co.uk ');</script>
    </body>
    </html>

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,519
    Thanks
    8
    Thanked 1,090 Times in 1,081 Posts
    I would create a <div> on your page that contains the HTML, graphics, content, links, etc.

    In your CSS stylesheet, you start out with that <div> hidden.
    display:none; keeps it hidden from view.

    #special{
    width:400px;
    height:300px;
    display:none;
    }

    In your page you have:

    <div id="special">
    Visit today for specials on blah blah blah.
    </div>

    Then you put this on the top of your page (in the <head> section) so that <div> appears when the page loads.

    <script src="jquery-1.8.2.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
    $('#special').fadeIn(1500);
    });
    </script>

    You also need to go to JQuery website and download the latest JQuery javascripting.
    Put that .js file in the same directory as your page (or wherever you decide).

    Using JQuery allows you to do many things, such as fade the <div> into view,
    fade it back out, etc.


    .

  • #3
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i am not very good at all this. kindly give me the whole code so i can just copy and paste on my website .. sorry for using your time thank u

  • #4
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    Quote Originally Posted by rufaspa View Post
    i am not very good at all this. kindly give me the whole code so i can just copy and paste on my website .. sorry for using your time thank u
    if you need someone to write an entire solution for your commercial website, you may want to head over to the job hiring forums.

  • #5
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    can anyone just help me with a few codes to add on this script please.

    all i want is when someone clicks ok button then my offers page opens and if they click cancel then they remain on my homepage. not much asking .. plz help

    please just edit the code below to my request.


    <html>
    <body>
    <script type="text/javascript">alert('Special Offer\n\nPamper Party Package\nOne Full Treatment + 2 Mini Treatments \n\nOnly £15* Each Person \n\n Book Now Email:- info@rufaspa.co.uk Call :- 07799 670 973 \n\n\n Check out our Special offer List on www.rufaspa.co.uk ');</script>
    </body>
    </html>

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,173
    Thanks
    203
    Thanked 2,549 Times in 2,527 Posts
    Quote Originally Posted by rufaspa View Post
    please just edit the code below to my request.
    Here you are. But if you know nothing about coding you should do what you would do in any other situation where you needed expert assistance - hire a professional. Why not the person who created your website? Presumably you would not attempt to service or repair a machine or appliance without any experience or understanding of how it worked.

    Code:
    <script type="text/javascript">
    
    var c = confirm ('Special Offer\n\nPamper Party Package\nOne Full Treatment + 2 Mini Treatments \n\nOnly £15* Each Person\n\nBook Now Email:- info@rufaspa.co.uk Call :- 07799 670 973 \n\n\nCheck out our Special offer List on www.rufaspa.co.uk ');
    if (c) {
    window.location.href = "http://www.rufuspa.co.uk/specialofferpage.html"
    }
    
    </script>
    Alert and confirm boxes are in effect obsolete and are seen nowadays as very primitive methods of communicating with the user. Ask a professional to do the job properly.
    Last edited by Philip M; 10-11-2012 at 08:30 PM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #7
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you very much....

    your a genius ...

    business isnt tht good so can not afford to hire a programer thts why trying to do as much as i can.
    but thnx alot for your help.. much appreciated


  •  

    Posting Permissions

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