Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

follow up Question for jsmckenzie: Date settings on the web  Date: 07/03/2002

Posted on 2002-07-11
8
Medium Priority
?
270 Views
Last Modified: 2013-12-25
This is a follow-up question for jsmckenzie regarding Question: Date settings on the web  Date: 07/03/2002 10:30AM PST      

I forgot to ask this:

After the day of the week and sign are found  (”You were born on a Friday and you are a Gemini”)

What I forgot to ask is I need to have a page loaded for each sign, example:  If the sign is Gemini then the
Gemini page would load giving the horoscope for that sign and so forth for each of the signs in the sodiac.

The way it is now is one page (page2.htm) loads for any sign.  This won’t work becuase each sign is different
and needs it’s own page.  The other advantage is I can edit each page to suit my needs.  Also, these pages are
going to be a general statement of the sign and do not have to modified for each day or week , so I just need a
page for each individual sign. Thanks fo the help.
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
  • 5
  • 3
8 Comments
 
LVL 2

Expert Comment

by:jsmckenzie
ID: 7147755
I don't have the code in front of me, but you could change page2.htm to redirect to a third page.  The last line of the javascript on page2.htm could be something like:

location.href = sSign + '.htm';

0
 

Author Comment

by:charliebcc
ID: 7149373
Sorry, that's a little vague for my limited knowledge.  I need more directions.  Thanks.  I can wait for the code if you have it. This way I will be sure of what I am doing.

0
 
LVL 2

Expert Comment

by:jsmckenzie
ID: 7149484
can you post the code again?  I don't have it with me here.
0
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.

 

Author Comment

by:charliebcc
ID: 7150405
Here it is:

Page 1

<html>
  <head>
     <title>page1.html</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.html">
        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>


Page 2 ****************************************************

<html>
  <head>
     <title>page2.html</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: 7152113
I inserted the code

location.href = sSign + '.htm';

as you stated and it works.  The only problem, and it is a minor one, is that the original statement "You were born on a 'day' and you are a 'sign'." is hidden by the new ".htm" page that comes up as requested.  Is there a way to pause the first page (page2.htm) or have the original information "You were born on a 'day' and you are a 'sign'." come up on the second page.  I hope this is clear.  
0
 
LVL 2

Accepted Solution

by:
jsmckenzie earned 400 total points
ID: 7155536
I've changed it a little so that you only need page1.htm:

************************ Page1.htm **********************

<html>
 <head>
    <title>page1.htm</title>
    <script language="javascript">
       var sQuery = location.search;
       var bSubmitted = sQuery.indexOf('submitted=1')!=-1
       if(bSubmitted)
          {
          afterSubmit()
          }
       
       function afterSubmit()
          {          
          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);
          location.replace(sSign + '.htm?day=' + sDayArray[oDate.getDay()])

          }

       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="page1.htm">
       <input type="hidden" name="submitted" value="1">
       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>

**********************************************************


******************** capricorn.htm ***********************

<html>
   <head>
      <title>capricorn.htm</title>
      <script language="javascript">
         var sQuery = location.search;
         var iDayPos = sQuery.indexOf('day=') + 4
         var sDay = sQuery.substring(iDayPos, sQuery.length);
         function writeResult()
          {
          document.write('You were born on a ');
          document.write(sDay);
          document.write(' and you are a Capricorn.')
          }
      </script>
   </head>
   <body>
      <script language="javascript">
         writeResult();
       </script>
   </body>
</html>

**********************************************************

Let me know if you have problems.
0
 

Author Comment

by:charliebcc
ID: 7160115
It works great!  Thanks so much for your help.

Charlie
0
 

Author Comment

by:charliebcc
ID: 7160118
Thanks again.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
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.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

722 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