Home News Contact us Blog   Get Listed

Search for C,C++,DAA Programs. Send video songs to your loved ones.

 
Custom Search
   

Shaadi.com Matrimonials

Knowledge Base
Question Bank Home
Gift your mate
Write Reviews

 

 

Important Questions: E-Commerce - Page 10

Page1 || Page2 || Page3 || Page4 || Page5 || Page6 || Page7 || Page8
Page9 || Page10 || Page11 || Page12 || Page13
 

 

Q49. What can a JavaScript Do?
Ans. 1.JavaScript gives HTML designers a programming tool - HTML authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into their HTML pages
2. JavaScript can put dynamic text into an HTML page - A JavaScript statement like this: document.write("<h1>" + name + "</h1>") can write a variable text into an HTML page
3. JavaScript can react to events - A JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element
4. JavaScript can read and write HTML elements - A JavaScript can read and change the content of an HTML element
5. JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server. This saves the server from extra processing
6. JavaScript can be used to detect the visitor's browser - A JavaScript can be used to detect the visitor's browser, and - depending on the browser - load another page specifically designed for that browser
7. JavaScript can be used to create cookies - A JavaScript can be used to store and retrieve information on the visitor's computer

Q50. How to Put a JavaScript Into an HTML Page?
Ans. <html>
<body>
<script type="text/javascript">
document.write("Hello World!");
</script>
</body>
</html>

Q51. How to Use an External JavaScript?
Ans. Sometimes you might want to run the same JavaScript on several pages, without having to write the same script on every page.
<html>
<head>
<script src="xxx.js"></script>
</head>
<body>
</body>
</html>

Q52. What are javascript functions?
Ans. A function contains code that will be executed by an event or by a call to that function.
You may call a function from anywhere within the page (or even from other pages if the function is embedded in an external .js file).
Functions can be defined both in the <head> and in the <body> section of a document. However, to assure that the function is read/loaded by the browser before it is called, it could be wise to put it in the <head> section.

Q53. Write example of function.
Ans. <html>
<head>
<script type="text/javascript">
function myfunction()
{
alert("HELLO");
}
</script>
</head>
<body>
<form>
<input type="button"
onclick="myfunction()"
value="Call function">
</form>
<p>By pressing the button, a function will be called. The function will alert a message.</p>
</body>
</html>

Previous    :   Next

© copyright 2008 created by www.citysuvidha.com