HOME | ABOUT US | EXAMPLE | PROJECTS | INTERVIEW | SOURCE CODE | FRAMEWORK | CONTACT | JOBS | WALKIN
dot net questions
ado.netassemblyasp.net basicobject oriented programmingcom dcomcssremotingsql servervb.netweb servicesxml
 
 

JAVA SCRIPT

Question:-How to create a clock in Javascript and time should display in textbox ?
Answer:
<SCRIPT LANGUAGE="Javascript">
var x = 10
var y = 1
function startClock()
{
x = x-y
document.frm.clock.value = x
setTimeout("startClock()", 1000)
if(x==0)
{
alert("BOOM");
x=10;
}
}
</SCRIPT>


Question:-How to add attribute of a server side Button in javascript ?
Answer:
In page load event just add Button1.Attribute.Add("onclick","_javascript:return function_name()");

Question:- What is JavaScript?
Answer:
JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language (a scripting language is a lightweight programming language) A JavaScript consists of lines of executable computer code A JavaScript is usually embedded directly into HTML pages JavaScript is an interpreted language (means that scripts execute without preliminary compilation) Everyone can use JavaScript without purchasing a license.

Question:-What can a JavaScript Do?
Answer:
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 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 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 JavaScript can read and write HTML elements - A JavaScript can read and change the content of an HTML element JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server, this will save the server from extra processing 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 JavaScript can be used to create cookies - A JavaScript can be used to store and retrieve information on the visitor's computer .


Question:-Syntax related to Popup Box ?
Answer:
In JavaScript we can create three kinds of popup boxes: Alert box, Confirm box, and Prompt box. Examples

Alert box: alert("sometext");
Confirm box: confirm("sometext")
Prompt box: prompt("sometext","defaultvalue")

Question:-Where to add Javscript Function and how ?
Answer:

<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>

Question:- What is a Cookie ?
Answer:
A cookie is a variable that is stored on the visitor's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With JavaScript, you can both create and retrieve cookie values. Examples of cookies: Name cookie - The first time a visitor arrives to your web page, he or she must fill in her/his name. The name is then stored in a cookie. Next time the visitor arrives at your page, he or she could get a welcome message like "Welcome John Doe!" The name is retrieved from the stored cookie Password cookie - The first time a visitor arrives to your web page, he or she must fill in a password. The password is then stored in a cookie. Next time the visitor arrives at your page, the password is retrieved from the cookie Date cookie - The first time a visitor arrives to your web page, the current date is stored in a cookie. Next time the visitor arrives at your page, he or she could get a message like "Your last visit was on Tuesday August 11, 2005!" The date is retrieved from the stored cookie.

Question:-How to Detect the visitor's browser and browser version ?
Answer:

<html>
<body>
<script type="text/javascript">
var browser=navigator.appName
var b_version=navigator.appVersion
var version=parseFloat(b_version)
document.write("Browser name: "+ browser)
document.write("<br />")
document.write("Browser version: "+ version)
</script>
</body>
</html>.


Question: How to get Length of string ?
Answer:

<html>
<body>
<script type="text/javascript">
var txt="Hello World!";
document.write(txt.length);
</script>
</body>
</html>.


Question: how to get any element of Webpage ?
Answer:

<html>
<head>
<script type="text/javascript">
function getElement()
{
var x=document.getElementById("myHeader");
alert("I am a " + x.tagName + " element");
}
</script>
</head>
<body>
<h1 id="myHeader" onclick="getElement()">Click to see what element I am!</h1>
</body>
</html>.


Question: Change the height and width of an image?
Answer:

<html>
<head>
<script type="text/javascript">
function changeSize()
{
document.getElementById("compman").height="250"
document.getElementById("compman").width="300"
}
</script>
</head>
<body>
<img id="compman" src="compman.gif" width="107" height="98" />
<br /><br />
<input type="button" onclick="changeSize()" value="Change size of image">
</body>
</html>

ADO.NET | ASSEMBLY | JAVA SCRIPT | OOPS | COM-DCOM | CSS | REMOTING | SQL SERVER | VB.NET | WEB SERVICES | XML | C#
SITEMAP | SQL SERVER QUERY | RESOURCES | ONLINE BOOKS SHOP
©2006-2007, dotnetquestion.info. All Rights Reserved.
Best View 1024 x 768