Monday, December 14, 2009

FAQs realted to JavaScripts...

JAVA SCRIPT
(Note: at5 many places code has been given as comment to prevent its action on blog)

FAQ No : 6259 What is JavaScript?
View the answer
FAQ No : 6465 What is the basic difference between Java and JavaScript and what are their different areas of application?
View the answer
FAQ No : 6487 How to insert movie in a web page?
View the answer
FAQ No : 6510 Why we dont use javascript as server side programming instead of vbscript??
View the answer
FAQ No : 6571 How can I disable a text input field?
View the answer
FAQ No : 6572 How do I do change the image when the mouse is over it?
View the answer
FAQ No : 6715 How do I disable the "Back" button of a browser?
View the answer
FAQ No : 6716 How do I pass the value of a text field when the submit button is pressed onto the next page?
View the answer
FAQ No : 6717 How do I reference functions in a different frame?
View the answer
FAQ No : 6855 Why does document.write() open a new window instead of writing to the current one?
View the answer

FAQ No : 6259   What is JavaScript?
JavaScript is an interpreted script language from Netscape mostly used for developing client and server Internet applications. The web browsers like IE and Netscape Navigator interprets Client-Side JavaScript statements embedded in an HTML page. It is different from Java, which is object oriented programming language from Sun Microsystems. top
FAQ No : 6465   What is the basic difference between Java and JavaScript and what are their different areas of application?
Java is an Object Oriented Programming (OOP) language created by James Gosling of Sun Microsystems. JavaScript was created by the fine people at Netscape. JavaScript is a distant cousin of Java. It is also an OOP language. Many of their programming structures are similar. However, JavaScript contains a much smaller and simpler set of commands than does Java. The main difference is that Java can stand on its own while JavaScript must be placed inside an HTML document to function. Java is a much larger and more complicated language that creates "standalone" applications. A Java "applet" (so-called because it is a little application) is a fully contained program. JavaScript is text that is fed into a browser that can read it and then is enacted by the browser. Another major difference is how the language is presented to the end user (thats you when youre surfing). Java must be compiled into what is known as a "machine language" before it can be run on the Web. Basically what happens is after the programmer writes the Java program and checks it for errors, he or she hands the text over to another computer program that changes the text code into a smaller language. That smaller language is formatted so that it is seen by the computer as a set program with definite beginning and ending points. Nothing can be added to it and nothing can be subtracted without destroying the program. JavaScript is text-based. You write it to an HTML document and it is run through a browser. You can alter it after it runs and run it again and again. Once the Java is compiled, it is set. Sure, you can go back to the original text and alter it, but then you need to compile again. Java applets run independent of the HTML document that is calling for them. Sure, they appear on the page, but the HTML document did little more than call for the application and place it. If the programmer allows it, oftentimes parameters can be set by the HTML document. This includes the background color of the applet of the type of text it displays, etc. The delivery of the applet is done through a download. The HTML document calls for the application, it downloads to the users cache, and waits to run. JavaScript is wholly reliant on the browser to understand it and make it come to life. top
FAQ No : 6487   How to insert movie in a web page?
Try inserting movies using the following command: or you can make a link to the file using the link tag like: YOUR FILE top
FAQ No : 6510   Why we dont use javascript as server side programming instead of vbscript??
JavaScript is an interpreted programming or script language from Netscape. In general, script languages are easier and faster to code in than the more structured and compiler languages such as C and C++. Script languages generally take longer to process than compiled languages, but are very useful for shorter programs. JavaScript is used in Web site development to do such things as: 1.Automatically change a formatted date on a Web page 2.Cause a linked-to page to appear in a popup window JavaScript uses some of the same ideas found in Java, the compiled object-oriented programming language derived from C++. JavaScript code can be embedded in HTML pages and interpreted by the Web browser (or client). JavaScript can also be run at the server as in Microsofts Active Server Pages (Active Server Page) before the page is sent to the requestor. VBScript is Microsofts answer to Netscapes popular JavaScript. Both are designed to work with an interpreter that comes with a Web browser - that is, at the user or client end of the Web client/server session. top
FAQ No : 6571   How can I disable a text input field?
Use the onfocus handler to call the blur() function: If you want to disable/enable dynamically use function skip
{ this.blur(); } disable text field enable text field top
FAQ No : 6572   How do I do change the image when the mouse is over it?
Use the onMouseOver and onMouseOut events to change the .src property of the image. Note that images are named using the name= element of the tag: onMouseOver = "document.homeImage.src='homeLitUp.gif'; return true;"> onMouseOut = "document.homeImage.src='homeNormal.gif'; return true;"> top
FAQ No : 6715   How do I disable the "Back" button of a browser?
In short you cant’ disable back button of the browser and the reason is simple.

You can’t tinker with the client settings in this manner, as this is considered illegal. You cannot totally remove the ability for the user to go back to the previous location, although you can make it harder through different means. You can use the location replace method when changing the location. This replaces the current history location with the new location. However older browsers do not support this method, which is why it is required to test for the images object.

Example:



-Alternatively,

you can load the new location into another window, and then close the old window.

In the first page



Open Window


In the next window





-Or

you can open a window without a toolbar:



-You can add code to the previous page to force the browser to go forwards again

top
FAQ No : 6716   How do I pass the value of a text field when the submit button is pressed onto the next page?
On the source page, try following:
On the next page that you wish to load, use following:
top
FAQ No : 6717   How do I reference functions in a different frame?
It is best to define functions within a single document, parent frameset-document, meaning the HTML document that defines the frameset(s).
Then a function may be referenced by using the following:
parent.frameName.function(); top
FAQ No : 6855   Why does document.write() open a new window instead of writing to the current one?
Once the current document has completed loading, you absolutely can not use document.write() to modify its contents. The default behaviour of document.write(), once the current document is done loading, is to open a new window of the type text/html, and deliver your output to that window.

The rule to remember is that the only opportunity you have to modify the display of the currently loaded document object is:
1. The contents of form elements
2. Document characteristics that are exposed via the document object model (like bgcolor)
3. Screen real estate in which applets or plugins are running
4) Screen real estate in which applets or plugins are running.
How do I get the IP address of the visitor?
View the answer
FAQ No : 6857 How can I print a page without the print dialog box?
View the answer
FAQ No : 6939 ·what is the difference between creteObject Method and createInstance Meathod ?
View the answer
FAQ No : 7037 Is there a way of automatically closing a window after a certain period of time i.e. without clicking a button or hyperlink.
View the answer
FAQ No : 7040 What is the difference between DHTML and ASP?
View the answer
FAQ No : 7059 How to hide javascript files?
View the answer
FAQ No : 7577 What is the main difference between ASP and servlets?
View the answer
FAQ No : 7631 What is the differnce between application and session?
View the answer
FAQ No : 7639 How can I call API function in ASP?
View the answer
FAQ No : 7751 How to write a code to print the text on the form?
View the answer

FAQ No : 6856   How do I get the IP address of the visitor?
You can capture the IP address of the visitor on your page.

In both Internet Explorer and Netscape Navigator try the folowing:

top
FAQ No : 6857   How can I print a page without the print dialog box?
In straight and simple words: You can't print without using print dialog box. top
FAQ No : 6939   ·what is the difference between creteObject Method and createInstance Meathod ?
In Microsoft Transaction Server (MTS), you must use ObjectContext.CreateInstance in your root object to create secondary objects for the transaction to flow. In COM+ this still works, but it is no longer necessary to do it. In COM+, CreateObject subsumes the functionality of ObjectContext.CreateInstance. The object created participates in the callers activity. In COM+, you can use the standard CreateObject function in Microsoft Visual Basic to flow a transaction to secondary objects as appropriate. top
FAQ No : 7037   Is there a way of automatically closing a window after a certain period of time i.e. without clicking a button or hyperlink.
Yes, this is possible but you will have to use a client side scripting language like JavScript or VB Script for this. Plain HTML will not work. top
FAQ No : 7040   What is the difference between DHTML and ASP?
DHTML (Dynamic HTML) is used for dynamically generate pages like changing the look and feel of the pages automatically depending on the user choice. But ASP (Active server Pages) performs server side validation i.e. when data is sent from the client to the server it is sent using ASP also when data is retrieved from the server for the client it is done using ASP. As ASP is a secure way of passing data from server to client and client to server . Also DHTML is used for client side validation and not server side processing. top
FAQ No : 7059   How to hide javascript files?
It is almost impossible to hide JavaScript source code because JavaScript code is stored in text files that are downloaded to the users computer. When the script is being executed, it will be downloaded to users PC. But you can specify the src in your This example uses the item method to retrieve a collection of all objects in the document having "Sample" as an id. It then uses item again to retrieve each object from the "Sample" collection. This example is similar to the previous example, but uses the optional iSubindex parameter of item to retrieve individual objects. top
FAQ No : 9063   How to connect to an access database using client side javascript ?
Use connection object to connect to database. you can use dsn or provider according to the access database version. ex, set con = createobject("adodb.connection") con.open Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Sid\Work\eSeed\Mdb\eSEED_11_Web_Designing.mdb;Persist Security Info=False top
FAQ No : 9216   The word application gets opened using javascript but how to open a doc file which is passed as a paramter to the function.?
Use the following code snippet: var wdApp = new ActiveXObject("Word.Application"); Use wdApp.Document.Open filename for Opening the document. top
FAQ No : 9264   How to open a word application using javascript?
The following code segment lets the user open a Word document directly: var pause = 0; var wdDialogFileOpen = 80; var wdApp = new ActiveXObject("Word.Application"); var dialog = wdApp.Dialogs(wdDialogFileOpen); var button = dialog.Show(pause);
FAQ No : 9299 What is the advantage using Session object over cookies
View the answer
FAQ No : 9408 How to display a value stored in a variable in JavaScript?
View the answer
FAQ No : 9713 How do change the color of the scrollbar?
View the answer
FAQ No : 10404 is it possible to resize or specify the X and Y placement of the alert box? that is, can i specify a particular size or location for the output of, say, alert("This is a test message.");
View the answer
FAQ No : 10530 How to write a complete date with the name of the day and the name of the month in javascript?
View the answer
FAQ No : 10531 How can you detect details about the clients monitor using javascript?
View the answer
FAQ No : 10533 How to pop up more than one window with just one click in javascript?
View the answer
FAQ No : 10535 How to print the page using javavscript?.
View the answer
FAQ No : 10536 How to round a number 8.25 to the nearest whole number using jaqvascript?
View the answer
FAQ No : 10551 How to test which of two numbers, has the higher value using javascript?.
View the answer

FAQ No : 9299   What is the advantage using Session object over cookies
Cookies are used to store data in the client side. The advantage of using session object comes when storing medium quantities of scalar data. Since information stored in these objects is kept in the memory of the server, storage and retrieval can be quite fast. top
FAQ No : 9408   How to display a value stored in a variable in JavaScript?
Try this code snippet to display the value of the variable through Javascript code:

This example declares a variable, assigns a value to it, and then displays the variable.

Then the variable is displayed one more time, only this time as a heading.

top
FAQ No : 9713   How do change the color of the scrollbar?
Step 1. Optional Style This is optional. If you leave it out, the browser will show the standard default color for the scrollbars (usually that is #C0C0C0). If you include this style, then you can set the initial scrollbar color to whatever you wish -- just change the #C0C0C0 to whatever color is required. The goes in the head of your page:
Step 2. The Script Put the following
Step 3. Calling the Script To set the color, just change the #FFFFFF format colors in the parentheses. (Careful to get the syntax with the single and double quotes just right!) Usually, youll attach the function to a link. Heres the actual code from our page, up above:
Change to Red
Change to Orange
Change to Yellow
Change to Green
Change to Blue
You can also, of course, call the code from any mouse event; for instance, try sliding your mouse over this, also from our page above, for an interesting effect: Change to Red
Change to Orange
Change to Yellow
Change to Green
Change to Blue
Obviously, you can carry this further, using onMouseOut, onClick, or other events. top
FAQ No : 10404   is it possible to resize or specify the X and Y placement of the alert box? that is, can i specify a particular size or location for the output of, say, alert("This is a test message.");
You actually cannot resize or set a target location for the default alert box, instead you can write the JavaScript for window.open and define the child windows coordinates and size and other parameters to show your alert messages as desired. top
FAQ No : 10530   How to write a complete date with the name of the day and the name of the month in javascript?
Try the following code: 7lt;/body> top
FAQ No : 10531   How can you detect details about the clients monitor using javascript?
Try the following code: top
FAQ No : 10533   How to pop up more than one window with just one click in javascript?
Try the folllowing code:
top
FAQ No : 10535   How to print the page using javavscript?.
Try the following code:
top
FAQ No : 10536   How to round a number 8.25 to the nearest whole number using jaqvascript?
Try the following code: < html> top
FAQ No : 10551   How to test which of two numbers, has the higher value using javascript?.
Try the following code:
FAQ No : 10555 Explain with example the Match() method in javascript?
View the answer
FAQ No : 10652 How can i send email message using javascript?
View the answer
FAQ No : 10670 Inside which HTML element do we put the javascript?
View the answer
FAQ No : 10705 Define the term Javascript?
View the answer
FAQ No : 10753 Difference between Jscript and JavaScript.
View the answer
FAQ No : 11654 How to change text within table cells?
View the answer
FAQ No : 11678 How to make an image move across the page?
View the answer
FAQ No : 11680 How can I scroll text across the screen without using the status bar and without using form fields?
View the answer
FAQ No : 11681 How to disable the View Source Menu available in the IE Browser(Using Java Scripting). And also how to enable the View Source Option Available in the Menu Bar(SubMenu) ?
View the answer
FAQ No : 11733 I need to display a message box inside my asp code.How can i acheive the same? Sample code: <% if a>b Then messagebox1 else messagebox2 %>
View the answer

FAQ No : 10555   Explain with example the Match() method in javascript?
The example shown below tests if a string contains a specified word and returns the word if it was found.

This example tests if a string contains a specified word. If the word is found it returns the word.

top
FAQ No : 10652   How can i send email message using javascript?
Try the following
This will send the email to the specifed address once the user has hit the submit button. If you want something else to force the submit then you would need to follow the same princple as above but do a document.myform.submit() to trigger it top
FAQ No : 10670   Inside which HTML element do we put the javascript?
Ans: Javascript is put inside the < SCRIPT > tag. top
FAQ No : 10705   Define the term Javascript?
JavaScript is an interpreted programming or script language from Netscape. It is somewhat similar in capability to Microsofts Visual Basic, Suns Tcl, the UNIX-derived Perl, and IBMs REX. In general, script languages are easier and faster to code in than the more structured and compiled languages such as C and C++. Script languages generally take longer to process than compiled languages, but are very useful for shorter programs. JavaScript is used in Web site development to do such things as: --Automatically change a formatted date on a Web page --Cause a linked-to page to appear in a popup window --Cause text or a graphic image to change during a mouse rollover JavaScript uses some of the same ideas found in Java, the compiled object-oriented programming derived from C++. JavaScript code can be imbedded in HTML pages and interpreted by the Web browser (or client). top
FAQ No : 10753   Difference between Jscript and JavaScript.
Netscape originally developed a scripting language for usage in its browsers calling it LiveScript [1]. Java being an internet buzzword for marketing reasons they renamed the scripting language to JavaScript. Microsoft implemented its own version of JavaScript and called it JScript. Both Netscape and Microsoft (and others) started standardizing the scripting language and used the ECMA standardizing organisation (http://www.ecma.ch) for that. Thus the language standard is called ECMAScript. Note that this standard is only about the core language with data and objects like numbers, strings, booleans, Object, Array, Function, Date, Math but NOT about application specific objects like browser specific objects (document, window, links, images etc). The core features of Netscapes JavaScript and Microsofts JScript are pretty much compliant with the ECMAScript standard. But the application specific objects like the browser DOM (document object model) or the server object model differ strongly. [1] Netscapes LiveScript was actually derived from CEnvi, the original forerunner to what is now known as JavaScript. CEnvi was a powerful yet easy to use interpreted version of the C programming language developed by NOMBAS (http://www.nombas.com). Of course, NOMBAS has since changed the name of its language to ScriptEase(TM) and expanded the implementation (marketed as ScriptEase Desktop) significantly, particularly to conform to the proposed ECMA standards and to ensure cross-platform compatibility. Netscape created the JavaScript language. The idea behind it was to allow programmers to speed up creating code while increasing activity and functionality of web pages. The intent is to enhance HTML. Netscape continues to enhance the language adding features such as Layers and Image arrays. Microsoft’s Internet Explorer Jscript does not currently support some features now available to JavaScript enabled browsers. Conflicts between both languages in the two browsers have encumbered JavaScript with some responsibility. However, since JavaScript came first, it has precedence over Microsoft’s Jscript. Some sites created in JavaScript will not work in Internet Explorer. The blame then does not lie with the language itself, but with browsers that do not support the language. This is detrimental because many users miss the opportunity to experience some very good sites that are not supported by Internet Explorer. top
FAQ No : 11654   How to change text within table cells?
The following code may be used but this code will work only in Internet Explorer 4+ // //
This is the text in ONE
This is the text in TWO
top
FAQ No : 11678   How to make an image move across the page?
The following code may be used to make an image move across the page:
top
FAQ No : 11680   How can I scroll text across the screen without using the status bar and without using form fields?
The following code may be used to scroll text across the screen without using the status bar and without using form fields:

top
FAQ No : 11681   How to disable the View Source Menu available in the IE Browser(Using Java Scripting). And also how to enable the View Source Option Available in the Menu Bar(SubMenu) ?
In internet explorer, go to Tools -> Options -> Security -> Custom -> Active Scripting -> Enable In netscape, go to Edit -> Preferences -> Advanced -> Enable JavaScript top
FAQ No : 11733   I need to display a message box inside my asp code.How can i acheive the same? Sample code: <% if a>b Then messagebox1 else messagebox2 %>
Just try this code on your end.

Sunday, December 13, 2009

Some Java Books:

http://www.4shared.com/file/171741644/58993a4c/0201310007Inside_Java_2_Platfo.html

http://www.4shared.com/file/171741822/ed3e15f5/_Addison_Wesley_2003__-_JavaSe.html

http://www.4shared.com/file/171742425/68f5d6dc/_Morgan_Kaufmann_2003__-_The_S.html http://www.4shared.com/file/172578817/f0f13c75/Sams_Teach_Yourself_Java_2_in_.html