Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-30-2012, 10:23 PM   PM User | #1
rufaspa
New to the CF scene

 
Join Date: Sep 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
rufaspa is an unknown quantity at this point
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>
rufaspa is offline   Reply With Quote
Old 10-01-2012, 02:49 AM   PM User | #2
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,055
Thanks: 8
Thanked 1,032 Times in 1,023 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
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.


.
mlseim is offline   Reply With Quote
Old 10-11-2012, 02:26 PM   PM User | #3
rufaspa
New to the CF scene

 
Join Date: Sep 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
rufaspa is an unknown quantity at this point
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
rufaspa is offline   Reply With Quote
Old 10-11-2012, 04:00 PM   PM User | #4
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,335
Thanks: 13
Thanked 207 Times in 207 Posts
DanInMa is on a distinguished road
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.
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 10-11-2012, 08:03 PM   PM User | #5
rufaspa
New to the CF scene

 
Join Date: Sep 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
rufaspa is an unknown quantity at this point
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>
rufaspa is offline   Reply With Quote
Old 10-11-2012, 08:24 PM   PM User | #6
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,100
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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.
__________________

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.

Last edited by Philip M; 10-11-2012 at 08:30 PM..
Philip M is offline   Reply With Quote
Old 10-13-2012, 01:36 AM   PM User | #7
rufaspa
New to the CF scene

 
Join Date: Sep 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
rufaspa is an unknown quantity at this point
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
rufaspa is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:56 AM.


Advertisement
Log in to turn off these ads.