GUVI
Back

Javascript solution here!

Created 2 years ago
7819 Views
11 Comments
narendra7770
@narendra7770
narendra7770
@narendra7770Profile is locked. Login

Some question are not solve.

/* ------__UNSOLVED QUESTION NO. 9, 13, 14, 23, 25, 28, 29___------*/
/* COMMENT YOUR ANSWER */

1. Change the color of the text "This is an Umbrella" to blue color by using javascript.

document.getElementById("sid").style.color = "blue";

2. Display the length of input field value with id 'myLength' in paragraph tag with id 'sid' using JS. Note: Values are assigned dynamically during validation.

function calculateLength(){
    //Write your code here
    var t1=document.getElementById("myLength").value;

   document.getElementById("sid").innerHTML= + t1.length;
}

3. Add values in Input 1 and input 2 fields with id 'in1', 'in2' and Display the resultant in the paragraph tag with id "result" Note: Values are assigned dynamically for evaluation.

function calculateSum(){
    //Start Your code here
  var n1 = parseInt(document.getElementById('in1').value);
  var n2 = parseInt(document.getElementById('in2').value);
  document.getElementById('result').innerHTML = n1 + n2;
}

4. Change the content of the paragraph tag with id name as hello from "Hello by HTML" to "Hello by JavaScript".
 
document.getElementById("hello").innerHTML = "Hello by JavaScript";

5. Hide the elements with id name as hello from "Hello by HTML" using JavaScript with display property.

document.getElementById("hello").style.display = "none";

6. Display "Hello World!" by using a p tag which is already present with id 'demo' in JavaScript.

document.getElementById("demo").innerHTML = "Hello World!";

7. Display "Hello from Guvian!" in a paragraph tag, using Javascript.

document.write("Hello from Guvian!")

8. Display the value of selected option in paragraph tag with id 'selectedOption' using Javascript. Note: Values are changed dynamically for evaluation

function getSelectedOption(){
document.getElementById("selectedOption").innerHTML=
document.getElementsByTagName("select")[0].value;

}getSelectedOption();

????9. Display the value of selected radio button in paragraph tag with id 'selectedOption' using Javascript. Note: Values are changed dynamically for evaluation.


10. Multiply given two inputs with id 'in1' and 'in2' and display the values in paragraph tag with id 'result' using Javascript.

function multiply(){
    //Start Your code here
    var n1 = parseInt(document.getElementById('in1').value);
   var n2 = parseInt(document.getElementById('in2').value);
    document.getElementById('result').innerHTML = n1*n2;
}

11. Check whether the given input string with id 'in1' includes 'Java'. if so, display true otherwise false in the paragraph tag with id 'result'.

function checkString(){
    //Start Your code here
    var str = document.getElementById('in1').value;
    var n = str.includes("Java");
    document.getElementById("result").innerHTML = n;
}

12. Join all the given array elements to form a comma seperated string ["Red","Green","White","Black"].Display the resultant in the paragraph with id "demo".

var color = ["Red","Green","White","Black"];
var result = document.getElementById("demo");
result.innerHTML = color.join();

?????13. Raju is 13 years old. Display in the given paragraph with id 'demo' as 'Eligible to vote' if he is eligible otherwise 'Not eligible'.

?????14. Given a number 4.4, Find the nearest greater number and display it in paragraph with id 'demo'.

document.getElementById("demo").innerHTML = Math.ceil(4.4);

15. Given two numbers in input 1 and input 2 of id 'in1' and 'in2' input fields .if input1 < input2, display 'true' otherwise 'false' in the given paragraph with id 'result'.

"Not Working"

var n1 = parseInt(document.getElementById('in1').value);
var n2 = parseInt(document.getElementById('in2').value);

if (n1 < n2) {
  greeting = "true";
}  else {
  greeting = "true";
}
document.getElementById("result").innerHTML = greeting;

16. Change the colour of the element with id name as "changeMeToBlue" to blue colour by using Java Script.

document.getElementById("changeMeToBlue").style.color ='blue';

17. Increase the font size of all the elements with class name as "increase" to 30px using JavaScript.

document.getElementsByClassName("increase")[0].style.fontSize = "30px";

18. Change the background colour of all the elements with class name as "changeMeToBlue" to blue colour by using Java Script.

document.getElementsByClassName("changeMeToBlue")[0].style.backgroundColor = "blue";

19. Align the contents to center with id_name as "alignToCenter" using JavaScript.

document.getElementById("alignToCenter").style.textAlign = "center";

20. Align the contents to right with id_name as "alignToRight" using JavaScript

document.getElementById("alignToRight").style.textAlign = "right";

21. Change the background colour of the given rectangle to blue color using JavaScript.

document.body.style.backgroundColor = "blue";

22. In the display, "Hello by HTML" is hidden using JavaScript. Show the hidden elements using JavaScript.

document.getElementById("hello").style.display = 'block';

????23. Insert "I am JavaScript" to the paragraph tag with id name as insert.

24. Display addition of 5 and 6 with a paragraph element with id name as "addition" using JavaScript.

var number  = document.getElementById("addition");
number.innerHTML = 5+6;

????25. Declare three variables a, b, and c and assign a with 10 and b with 20 and give addition of a and b to c. Display the result in paragraph tag as "C = 30".

26. Assign "Hello" to a string variable, 1 to a variable, print both in same line using Java Script.

var string = "Hello";
var number = 1;
document.getElementById("demo").innerHTML = string  + number ;

27. Print the numbers from 1 to 5 using Javascript using for loop(give space between each number))

text="";
var i;
for (i = 1; i < 6; i++) 
{
  text += " " + i;
}
document.getElementById("demo").innerHTML = text;

?????28. Given an array, Print the elements which are greater than 5 in acending order from that numbers using javascript. if input is 45, 4, 9, 16, 25 Use ',' to separate numbers and Print use the fun() function to process !

????29. Display Date of the timestamp from the input field use only IST result should be in p tag (example: timestamp of 1382086394000 must have a output --> Tue Jul 29 45766 12:43:20 GMT+0530 (India Standard Time).

30.Given a array, sort the array in Ascending order and print, using Javascript array=[40, 100, 1, 5, 25, 10]; Example(array=[5,4,3,2,1] sorted array 1,2,3,4,5 in p tag)

var points = [40, 100, 1, 5, 25, 10];
points.sort((function(a, b){return a - b}));
document.getElementById("demo").innerHTML = points;














Comments (11)
Please login to comment.
 
Powered by habitate.io Habitate