Category: javascript

How to enable button in JavaScript

{0 Comments}

To enable button in JavaScript you can the same script which you can use to disable button but only thing which you change it the Boolean value to false as show in the following function.  To do this the value is get the element id of button first then apply following syntax.   Javascript |  copy code |? 1function enable() {2 …

Read More…

How to enable text box in JavaScript

{0 Comments}

To enable textbox in JavaScript you can the same script which you can use to disable textbox but only thing which you change it the Boolean value to false as show in the following function.   Javascript |  copy code |? 1function enable() {2 document.getElementById( "Text1" ).disabled = ‘false’;3 }4

Read More…

How to declare function in JavaScript

{0 Comments}

To declare a function in JavaScript you can use following syntax, this is the standard way to declare function. First write a keyword “function” then write function name then braces. As shown below  Javascript |  copy code |? 1function functionname()2 {3 }4

Read More…

How to declare integer variable in JavaScript

{0 Comments}

As you want to declare integer variable in JavaScript then you can declare this in default manner.  var varname=  1; like that. But when this is need to sure that the variable declared here is integer or not then you can use following syntax have declare integer variable in JavaScript.  Javascript |  copy code |? 1var a = arg;2 3 var …

Read More…

How to declare static variable in JavaScript

{0 Comments}

Declaration of a variable in JavaScript is describer in earlier post. But when it comes to declaration of static variable in JavaScript you can use following syntax. Here you can declare a static variable inside a function this will hold the value during the function calls.  Javascript |  copy code |? 1function somefun(arg)2 {3 var a = arg;4 5 }6

Read More…

How to declare Boolean in JavaScript

{0 Comments}

As we know Boolean value is 1 and 0, or true and false. But in this scenario when you declare var a=1 here JavaScript take as a integer value so. To declare Boolean in JavaScript all you have to write true and false to declare it as Boolean.  C# |  copy code |? 1var variablename=true;

Read More…

How to declare string in JavaScript

{0 Comments}

You can declare string in JavaScript like a variable declared. Because here you don’t have to declare data type as a string all you have to declare or assign the string value to  default variable and it will considered as a string value.  You can read following article how to declare variable in JavaScript. How …

Read More…

How to declare variable in JavaScript

{0 Comments}

When it comes to declare the variable in JavaScript it is much more similar like most popular programming languages. Here we have to use var keyword which automatically takes the data type of the variable on assigning it which is much more similar to php. After  var keyword all you have to give a name …

Read More…

How to disable link in JavaScript

{0 Comments}

You can disable the link in JavaScript by getting the element id of the link or get the element tag which is here is <a> tag and then apply the property to it.  Whose syntax will look like as follows:  Javascript |  copy code |? 1function disable() {2 document.getElementById( "linkID" ).disabled = ‘true’;3 //or4 document.getElementsByTagName("a").disabled=’true’;5 }6 Or you can use …

Read More…

How to disable right click in JavaScript

{0 Comments}

We have already written a script to disable copy and paste in the browser. Which also disable right click of the browser too so you can use the same JavaScript to disable right click which is as follows   Javascript |  copy code |? 01 <script language="javascript"> 02function click() { 03return false;} 04function click1(){if (event.button==2) {return false; }} 05function CtrlKeyDown(){ 06if …

Read More…