In this javascript code if else statement working very well but i don't know why remaining code is not working?

var myVideo = document.getElementById("player"); 
function playPause() { 
    if (myVideo.paused) 
        myVideo.play(); 
    else 
        myVideo.pause(); 
}
function skip(value) {
        myvideo.currentTime += value;
    }   
function vdwn() { 
    myvideo.volume = 0.2;
} 
  
function vup() { 
    myvideo.volume = 1.0;
}
   $("#resize").click(function(){
  $("#player").css("width", "100%");
  $("#p").text("doubule click on resize button to decrease the size");
});
$("#resize").dblclick(function(){
$("#player").css("width", "50%");
$("#p").text("  ");
});

in this javascript code if else statement working very well but i don’t know why remaining code is not working.

My knowledge of JavaScript is very limited and I stand to be corrected :slight_smile:

Does the above function require an endif?

Your variable is named myVideo, but you’re trying to use myvideo (lowercase v) which won’t work.

1 Like

yes, you are right js is case sensitive thankyou :slight_smile:

no enif is required in js and thanks for the trying to help me :slight_smile:

1 Like

I Googled for “validate javascript” and found numerous online test pages.

I tried quite a few pages, started digging a hole and was getting deeper so quit :frowning:

The code example does look off, so I can understand how it might resemble PHP’s Alternative syntax for control structures

I always do

if(a == i){
 b=i;
}else{
 b=null;
}

with the curly braces

They are optional when there’s only one statement in the block but you never know if you might need to add extra code to the block so having them there already helps you to avoid breaking the code if you do add an extra statement (eg. for quick debugging).

I agree that they should always be included.

1 Like

Another thing that looks off, unless just I’m not seeing it. Is the example functions and the example jQuery have absolutely nothing to do with each other.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.