Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Date settings on the web

Posted on 2002-07-03
4
Medium Priority
?
186 Views
Last Modified: 2013-12-25
I am building a horoscope website and I would like to have users type in their date of birth and have a page appear that tells them what day they were born on and what there astrological sign is.  Example: they type in 3/11/48 and they get a page that tells them:

   "YOU ARE A PISCES AND YOU WERE BORN ON THURSDAY"
or
   "YOU WERE BORN ON THURSDAY AND YOU ARE A PISCES"

Is there any kind of scripts out there that can do this?

Thanks for the help.

Charlie

 
0
Comment
Question by:charliebcc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
jsmckenzie earned 1600 total points
ID: 7129107
------page1.htm--------------------------------
<html>
   <head>
      <title>page1.htm</title>
      <script language="javascript">
         function generateOptions(sName,iNum)
            {
            document.write('<select name="' + sName + '">');
            for(var i=1; i<=iNum; i++)
               {
               document.write('<option value="' + i + '">' + i + '</option>');
               }
            document.write('</select>');
            }
      </script>
   </head>
   <body>
      <form name="frmScope" method="get" action="page2.htm">
         Enter Your Birthday:
         <br>
         <script language="javascript">
            document.write('Month:');
            generateOptions('cboMonth',12);
            document.write('<br>Day:');
            generateOptions('cboDay',31);
         </script>
         <br>
         Year: <input type="text" name="txtYear" maxlength="4" size="4" value="1900">
         <br><br>
         <input type="button" value="Submit" onClick="frmScope.submit()">
      </form>
   </body>
</html>

------page2.htm--------------------------------
<html>
   <head>
      <title>page2.htm</title>
      <script language="javascript">
         var sQuery = location.search;
         var iYearPos = sQuery.indexOf('txtYear=') + 8
         var iDayPos = sQuery.indexOf('cboDay=') + 7
         var iMonthPos = sQuery.indexOf('cboMonth=') + 9
         var iYear = sQuery.substring(iYearPos, sQuery.length);
         var iDay = parseInt(sQuery.substring(iDayPos, iDayPos + 2));
         var iMonth = parseInt(sQuery.substring(iMonthPos, iMonthPos + 2));
         var sSign='';
         
         switch(iMonth)
            {
            case 1: iDay <=19 ? sSign = 'Capricorn' : sSign = 'Aquarius'; break;
            case 2: iDay <= 18 ? sSign = 'Aquarius' : sSign = 'Pisces'; break;
            case 3: iDay <= 20 ? sSign = 'Pisces' : sSign = 'Aries'; break;
            case 4: iDay <= 19 ? sSign = 'Aries' : sSign = 'Taurus'; break;
            case 5: iDay <= 20 ? sSign = 'Taurus' : sSign = 'Gemini'; break;
            case 6: iDay <= 21 ? sSign = 'Gemini' : sSign = 'Cancer'; break;
            case 7: iDay <= 22 ? sSign = 'Cancer' : sSign = 'Leo'; break;
            case 8: iDay <= 22 ? sSign = 'Leo' : sSign = 'Virgo'; break;
            case 9: iDay <= 22 ? sSign = 'Virgo' : sSign = 'Libra'; break;
            case 10: iDay <= 22 ? sSign = 'Libra' : sSign = 'Scorpio'; break;
            case 11: iDay <= 21 ? sSign = 'Scorpio' : sSign = 'Sagittarius'; break;
            case 12: iDay <= 21 ? sSign = 'Sagittarius' : sSign = 'Capricorn'; break;
            }

         var sDayArray = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
         var sMonthArray = ['','January','February', 'March','April','May','June','July','August','September','October','November','December'];
         
         var oDate = new Date(iDay + ' ' + sMonthArray[iMonth] + ', ' + iYear);

         function writeResult()
            {
            document.write('You were born on a ');
            document.write(sDayArray[oDate.getDay()]);
            document.write(' and you are a');
            if(sSign=='Aquarius' || sSign=='Aries') document.write('n');
            document.write(' ' + sSign + '.');
            }

      </script>
   </head>
   <body>
      <script language="javascript">
         writeResult();
      </script>
   </body>
</html>
0
 

Author Comment

by:charliebcc
ID: 7129924
I copied each page designation into separate html pages using notepad.  Meaning "Page1" information went into an html page called page1.html and the same with the "page2" information.  When I launch the first page everything comes up fine.  I enter the date information and hit the submit button and I get a message saying "The page cannot be displayed." Any suggestions?  Should page2 have a different name? Awaiting you most valued help.

Charlie

0
 

Author Comment

by:charliebcc
ID: 7129936
I found my error.   I had page2 named page2.html instead of page2.htm.  I changed the name ofthe page and it works great.  I doubled the points to show my appreciation on what a great job you did.  Thanks so very much.  And keep up the great work!

Charlie
0
 
LVL 2

Expert Comment

by:jsmckenzie
ID: 7130335
you're welcome-- glad i could help, and thanks for the grade.
0

Featured Post

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question