Monday, 24 May 2021

WT-28

 Q1. Write a JavaScript function that checks whether a input string is palindrome or not.

<html>

<head>

<script>        

function myFunction()

{

var str = document.getElementById('a').value;

var result = checkPalindrome(str);

alert('The Entered String "'+str +'" is "'+result+'"');

}

function checkPalindrome(str)

{

var orignalStr;

orignalStr = str;

str = str.split('');

str = str.reverse();

str = str.join('');

var reverseStr = str;

if(orignalStr == reverseStr){

return 'Palindrome';

}else{

return 'Not Palindrome';

}

}

</script>

</head>

<body>

<input type="text" id="a" placeholder="Enter String" />

<input type="button" onclick="myFunction()" value="Check Palindrome" />

</body>

</html>      

Q2. Write HTML and CSS code to design a web page. Divide the browser screen into two frames. The first frame will display the heading. The second frame contains a menu consisting of hyperlinks. Clicking on any one of these hyperlinks will display related information in a new page  

<html> 

<frameset rows = "30%,*"> 

<frame name = "top" src = "frame_1.html" /> 

<frameset cols = "30%,*"> 

<frame name = "main" src = "frame_2.html" /> 

<frame name = "button" src = "frame.html" /> 

</frameset>

</frameset>

</html>

 

frame_1.html

<html>

<body>

<head><h1><font> IT Industries in INDIA</h1></head>

</body>

</html>

 

frame_2.html

<body>

<ul>City

<ol type="1">

<li><a href="pune.html" target="button">Pune</a></li>      

<li><a href="Mumbai.html" target="button">Mumbai</a></li>      

</ol>

</ul>

</body>

</html>

 

pune.html

<body>

<ul type="square">Pune

<ul type="circle">

<li>Infosys1</li>

<li>Persistent1</li>

<li>Microsoft1</li>

</ul>

</ul>

</html> 

mumbai.html

<body>

<ul type="square">Pune

<ul type="circle">

<li>Infosys1</li>

<li>Persistent1</li>

<li>Microsoft1</li>

</ul>

</ul>

</html>