Posts

Welcome to Vitamin JS

Hello Friends , this is Kiran adding a new Blog Vitamin JS   into Key_ttu Family. The programs done by us in C language is also done in this JavaScript Code so one can easily get a Overlook of a same program in different Languages at Same Place . So Be ready to Boost your WebPages ... 1 2 3 Let the Vitamin JS Begin

How to set a Background image in HTML page

Program : <html> <style> h2{ color: white; font-family: Comic Sans MS; background-image: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiio6okknquvxl6ly2FM5bFmPAJRIHXznTz3Jvnc8ktNv4HkQZhhBBvJd4xtQpcNppQzBzcjfTsybNYIyy7oUPt_FYBzVBUFl3ub5Usl-iPWXRELSQpo8pP82IDIHes3JjPK4QQEVnYvt8/s1600/4478233-colorful-backgrounds.jpg); } div{ color : black; font-size:20px; font-family: Verdana; } </style> <body> <br /> <center> <h2> HOW TO USE BACKGROUND IMAGE IN JAVASCRIPT <br />LIKE THIS</h2> <div id="Answer" padding=128px 60px > First Define Color and Font Family and then Link a image through URL <br /> Example : <br /> <br />h2{<br /> color: white;<br /> font-family: Comic Sans MS;<br /> background-image: url();<br /> } <br /> </div> <script> </script> </center> </body> </html> you can execute this code at : http://v...

Star to Delta and Delta to Star using JavaScript

Hi friends , Lets Code for Star to Delta and Delta to Star , this helps us in Implementing Mathematical Formulas in JavaScript .... Program : <html> <body> <center> <h2> STAR TO DELTA CONVERSION </h2> ENTER RESISTANCE IN STAR FORM <br /><br /> Ra = <input type="text" id="Ra" /> <br /> Rb = <input type="text" id="Rb" /> <br /> Rc = <input type="text" id="Rc" /> <br /> <br /> <input type="submit" onclick="startodelta()" value="Convert TO DELTA" /><br /><br /> RA = <input type="text" id="textbox1" readonly="true" /> <br /> RB = <input type="text" id="textbox2" readonly="true" /> <br /> RC = <input type="text" id="textbox3" readonly="true" /> <br /> <br /...

Number System Conversions in JavaScript

Hi Friends lets convert a Number into Different Number systems using JavaScript Program : <html> <h2>NUMBER SYSTEM CONVERSIONS </h2> <script> function numbersystem() { var num=parseInt(document.getElementById("num").value); var binary=num.toString(2); var octal=num.toString(8); var hexadec=num.toString(16); var decimal=num.toString(10); var base5=num.toString(5); var base7=num.toString(7); var textbox2=document.getElementById('textbox2'); textbox2.value=(binary); var textbox3=document.getElementById('textbox3'); textbox3.value=(octal); var textbox4=document.getElementById('textbox4'); textbox4.value=(hexadec); var textbox5=document.getElementById('textbox5'); textbox5.value=(decimal); var textbox6=document.getElementById('textbox6'); textbox6.value=(base5); var textbox7=document.getElementById('textbox7'); textbox7.value=(base7); } </script> ENTER A NUMBER   - <input type="text...

Date Function in JavaScript

Lets have a Look at Date Function in JavaScript Program : <html> <body> <h2>DATE</h2> <script> var x= new Date(); document.write(x.getDate()+"/"); document.write(x.getMonth()+1+"/"); document.write(x.getFullYear()); </script> </body> </html> In this we are Getting Date Month and year separately and printing them , and we are adding 1 to month because in JS the Month starts from 0 and ends with 11 so we are adding 1 to Month and printing that ... Calculate Difference Between Two Dates : Program : <html> <style> .size { font-size:20px; } </style> <body> <h2>DATE DIFFERENCE</h2> <h3> START DATE </h3> DATE <input type="text" name="textbox1" class="size" id="date" /> / MONTH <input type="text" name="textbox1" class="size" id="month" /> / YEAR <input type=...

Operators and Expressions in JavaScript

Operator Description Associativity () Parentheses Left to right ++      – – Auto increment, decrement Right to left ! Logical NOT Right to left *     /     % Multiply, divide, modulus Left to right +     – Add, subtract Left to right + Concatenation Left to right <     <= Less than, less than or equal to Left to right >     >= Greater than, greater than or equal to Left to right = =         != Equal to, not equal to Left to right = = =     != = Identical to (same type), not identical to Left to right & Bitwise AND Left to right | Bitwise OR ^ Bitwise XOR ~ Bitwise NOT << Bitwise left shift >> Bitwise right shift >>> Bitwise zero-filled, right shift && Logical AND Left to right || Logical OR Left to right ? : Ternary, conditional Right to l...

Factorial of a Number

Hi friends  Lets design a webpage which calculated FACTORIAL of a Given Number Html Code : <html> <h2> Calculate FACTORIAL of Number </h2> <style> .button { font-size: 30px; } .size { font-size:30px; } </style> <script> function factorial() { var num=document.getElementById("textbox1").value; var ans=1; for(i=num;i>0;i--) { ans*=num; num--; } var textbox2=document.getElementById('textbox2'); textbox2.value=ans; } </script> <body> <input type="text" name="textbox1" class="size" id="textbox1" /><br /> <br /> <input type="submit" name="button" class="button" onclick="factorial()" value="CALCULATE" /><br /> <br /> <input type="text" name="textbox2" class="size" id="textbox2" readonly="true" /><br /><br...

Set Password For Your WebPage using JavaScript

Hi friends , lets see how to set password for our webpage using JavaScript ... Program: <script language='javascript'> <!--hide var password; var pass1='password'; password=prompt('Enter',''); if(password==pass1) alert('Welcome, Click to enter'); else { window.location="http://www.msn.com"; } //--> </script> This is the JavaScript Code for Setting password to your Webpage , Paste this code inside the body of your HTML Code and then Change the text in the Code "Password" to your Desired text which you want to set as Password .. If entered password is wrong it redirects to  http://www.msn.com , you can decide where to go on your Interest , example Google.com or etc. Best thing Paste this Code at the Beginning of your body , then you can Hide everything while prompt is asking Password !?! HTML Code : <html> <body> <script language='javascript'> <!--h...