Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'event.html'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. Hi, everyone When i'm running the event.js script (below) on: Opera, Chrome, Safari, it work perfectly but not on Firefox. And the thing is that the original Larry Ullman version seems to work on Firefox. I think I did something wrong here is the code //begin the process() function //the process() function will do the work when the form is sunmitted function process() { 'use strict'; //get references to the HTML elements var start = document.getElementById('start'); var end = document.getElementById('end'); var output = document.getElementById('output'); // the two first vars reference the two text input. the third is a ref to the "div" output //Declare three vars fro the output var message = ''; var interval = ''; var day = 1000 * 60 * 60 * 24; //create two new Date() objects var startDate = new Date(start.value); var endDate = new Date(end.value); if( startDate.getTime() && endDate.getTime() ) { //make sure the start date comes first by a simple comparison if(startDate < endDate) { // Determine the interval between the two dates var diff = endDate - startDate; //the result will be in millisecond; if(diff <= day)//conditional if diff <= day the interval is 1 day else its several days { interval = '1 day'; }else { interval = Math.round(diff/day) + ' days'; } //generate the message to be displayed message = 'The event has been scheduled starting on ' + startDate.toLocaleDateString(); message += ' and ending on ' + endDate.toLocaleDateString(); message += ' , wich is a period of ' + interval + '.'; }else //create the errors as messages { message = 'The start date must come before the end date!'; }//end of if(startDate < endDate)... else 'message' }else { message = 'Please enter a valid start and end dates int format MM/DD/YYYY.'; }//end of if(startDate.getTime() endDate.getTime())....else 'message' //update the page with the custom message if(output.texContent !== undefined) { output.textContent = message; }else { output.innerText = message; } //complete the function return false; } //add an event listener to the form's submission function init() { 'use strict'; document.getElementById('theForm').onsubmit = process; }//end of init() function window.onload = init;
×
×
  • Create New...