Click here to Skip to main content
15,881,812 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: Hi, I really new to javascript. I was doing a JavaScript program that accept two integers and display the larger. Pin
Richard Deeming18-Jan-17 8:50
mveRichard Deeming18-Jan-17 8:50 
GeneralRe: Hi, I really new to javascript. I was doing a JavaScript program that accept two integers and display the larger. Pin
abdul kabeer19-Jan-17 7:38
abdul kabeer19-Jan-17 7:38 
AnswerRe: Hi, I really new to javascript. I was doing a JavaScript program that accept two integers and display the larger. Pin
Pawan Kumar18-Jan-17 8:24
Pawan Kumar18-Jan-17 8:24 
Questiontrying to make a date difference variable auto populate another text box (in another function) Pin
Barnsley711-Jan-17 23:16
Barnsley711-Jan-17 23:16 
AnswerRe: trying to make a date difference variable auto populate another text box (in another function) Pin
Richard Deeming12-Jan-17 7:06
mveRichard Deeming12-Jan-17 7:06 
GeneralRe: trying to make a date difference variable auto populate another text box (in another function) Pin
Barnsley712-Jan-17 22:30
Barnsley712-Jan-17 22:30 
QuestionHow to dynamically Add and Close tab items in Browser Pin
Aniruddha.A10-Jan-17 17:42
Aniruddha.A10-Jan-17 17:42 
QuestionCalendar next / previous links not working javascript Pin
hmkoyan8-Jan-17 2:07
hmkoyan8-Jan-17 2:07 
I am trying to write code for my calendar next and previous buttons. But after a lot of tries I still can't figure it out. Here is HTML:
<div class="calendar-container">
    <div class="calendar-header">
      <a href="#" class="arrows" id="prevArrow">
          <div class="prev-arrow-container"></div>
      </a>
      <div class="year-month-selector">
        <select id="year" class="select-properties"></select>
        <select id="month"  class="select-properties"></select>
      </div>
      <a href="#" class="arrows" id="nextArrow">
          <div class="next-arrow-container"></div>
      </a>
    </div>

    <div class="calendar-body" id="calendar-body">
      <div class="day-names" id="dayNames"></div>
      <div id="days-container"></div>
    </div>
  </div>

Here is some JS:
setHandlers() {
var prevButton = document.getElementById('prevArrow');
var nextButton = document.getElementById('nextArrow');

nextButton.addEventListener('click', function () {
  this.next();
}.bind(this));}

 next() {
var currentYear = this.currentDate.getFullYear();
var currentMonth = this.currentDate.getMonth();

if (currentYear === YEAR_END && currentMonth === 11) {
  return;
}
this.currentDate.setMonth(currentMonth + 1);
this.setDate();}

setDate() {
var currentYear = this.currentDate.getFullYear();
var currentMonth = this.currentDate.getMonth();

this.yearSelector.selectedIndex = currentYear - YEAR_START;
this.monthSelector.selectedIndex = currentMonth;}

createDays() {
var daysContainer = document.getElementById('days-container');
var newDate = new Date(this.currentDate.getFullYear(), this.currentDate.getMonth() + 1, 0);
var lengthOfMonth = newDate.getDate();
var date = 1;
for (var i = 0; i < 42; i++) {
    var day = daysContainer.children[i];
    if(i < this.startingCell) {
        day.innerText = "prev";
        day.style.opacity = '.2'
    } else if (i > this.startingCell + lengthOfMonth){
        day.innerText = "next";
        day.style.opacity = '.2'
    } else {
        day.innerText = date;
        date++; 
    }
}}

The whole source can be found here. Any kind of help is appreciated. It would be okay that you give hints about how to link one of the buttons to the calendar-body, that is when of the prev/next is clicked the calendar-body content is changed respectively back and forward. Thanks in advance.
QuestionRe: Calendar next / previous links not working javascript Pin
ZurdoDev9-Jan-17 7:19
professionalZurdoDev9-Jan-17 7:19 
QuestionHow to override .js file Pin
Member 129321392-Jan-17 22:26
Member 129321392-Jan-17 22:26 
QuestionPopup div Pin
Otekpo Emmanuel25-Dec-16 3:00
Otekpo Emmanuel25-Dec-16 3:00 
AnswerRe: Popup div Pin
Afzaal Ahmad Zeeshan25-Dec-16 3:41
professionalAfzaal Ahmad Zeeshan25-Dec-16 3:41 
GeneralRe: Popup div Pin
Otekpo Emmanuel25-Dec-16 4:42
Otekpo Emmanuel25-Dec-16 4:42 
GeneralRe: Popup div Pin
Afzaal Ahmad Zeeshan25-Dec-16 4:47
professionalAfzaal Ahmad Zeeshan25-Dec-16 4:47 
QuestionRe: Popup div Pin
ZurdoDev28-Dec-16 3:32
professionalZurdoDev28-Dec-16 3:32 
AnswerRe: Popup div Pin
ZurdoDev25-Jan-17 9:02
professionalZurdoDev25-Jan-17 9:02 
QuestionJavaScript Uncaught ReferenceError: WScript is not defined Pin
Member 1291970223-Dec-16 10:00
Member 1291970223-Dec-16 10:00 
AnswerRe: JavaScript Uncaught ReferenceError: WScript is not defined Pin
Afzaal Ahmad Zeeshan24-Dec-16 8:08
professionalAfzaal Ahmad Zeeshan24-Dec-16 8:08 
AnswerRe: JavaScript Uncaught ReferenceError: WScript is not defined Pin
ZurdoDev27-Dec-16 9:14
professionalZurdoDev27-Dec-16 9:14 
Questiondocument.referrer help Pin
sc1311118-Dec-16 22:17
sc1311118-Dec-16 22:17 
AnswerRe: document.referrer help Pin
Richard Deeming19-Dec-16 2:42
mveRichard Deeming19-Dec-16 2:42 
QuestionFunction to get location its not working in Android . How to find user device is gps is on or off Android or ios using js? Pin
Sathiya moorthi17-Dec-16 1:55
Sathiya moorthi17-Dec-16 1:55 
AnswerRe: Function to get location its not working in Android . How to find user device is gps is on or off Android or ios using js? Pin
Richard MacCutchan17-Dec-16 1:57
mveRichard MacCutchan17-Dec-16 1:57 
AnswerRe: Function to get location its not working in Android . How to find user device is gps is on or off Android or ios using js? Pin
Kornfeld Eliyahu Peter17-Dec-16 6:03
professionalKornfeld Eliyahu Peter17-Dec-16 6:03 
AnswerRe: Function to get location its not working in Android . How to find user device is gps is on or off Android or ios using js? Pin
Afzaal Ahmad Zeeshan17-Dec-16 6:04
professionalAfzaal Ahmad Zeeshan17-Dec-16 6:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.