Read How to send and receive JSON data at both client and server sides
http://www.javapassion.com/ajax/JSON.pdf
Look for classes and functions. You can tell when a JAVA "function" is opening with a class declaration like: class FirstProg
or a code line like: public static void main ()
Look for System commands. JAVA uses 'system' as a root to accomplish some methods, as in: System.out.print to print text.
Look for dimensioning variables. JAVA dimensions variables by a variable type name and a variable name, for example, an integer called FirstOne would be dimensioned this way in JAVA code: int FirstOne.
Look for the simple addition command. This is peppered through most JAVA code as a way to incrementally program methods. It's not the exclusive property of JAVA, as programming languages like C have identical syntax, but it is a notable part of JAVA code. For example, to add 1 to an integer x, the JAVA code would be: x++
Look for Applet-related commands. The JAVA Applet is a JAVA invention, and the language contains specific commands to work with the Applet object. Syntax for Applets includes items like AppletHeight and AppletWidth as well as items like naming and parameters, for which JAVA uses its own syntax. Applets can also be added to web pages as code modules.
Start a new web page and include the opening and closing script tags in the web page header. The web page can be authored in a text or web page editor such as Adobe's DreamWeaver. The code to do this is:
<head>
<script>
</script>
</head>
Define a JavaScript method called MsgBox, which will accept a text string as an input argument within the opening and closing script tags. Within the MsgBox method, invoke the JavaScript alert method using the text string that is passed to the method as the data to display. This method will be invoked when the user clicks a form entry box that will be defined in a later step. The code to do this is:
<script>
function MsgBox (textstring)
{
alert (textstring)
}
</script>
Create the HTML code to accept a text input from the user that will be passed to the JavaScript method MsgBox. When the user selects the submission button, the text will be displayed to the user in an alert box. The code for the form is:
<body>
<FORM>
<INPUT NAME="text1" TYPE=Text>
<INPUT NAME="submit" TYPE=Button VALUE="Show A Javascript Alert" onClick="MsgBox(form.text1.value)">
</FORM>
</body>
</html>
Save the webpage and view it in your web browser. The data input into the text field will display in a JavaScript alert when you click the submission button.
Open Maxthon. Locate the toolbar and click on "Tools."
Scroll down and click on "Maxthon Options."
Locate and click on "Advanced" in the left-hand column. In the center of the screen, locate "Java Virtual Machine."
Check to see that "Other Virtual Machine Installed" is selected. If it isn't, select it by clicking on the box. Click "OK" at the bottom of the box to save and close.
For Internet Explorer, click Tools, then Internet Options, then Security and then Custom Level.
Select Enable in the Scripting and Active Scripting section. Click OK.
Click Yes when asked, "Are you sure you want to change the settings for this zone?"
For Firefox, select Tools, then Options and then Content.
Select Enable JavaScript.
Create a new, blank XML document contained in the head node of a web page by using the following code:
Var myXMLdoc = document.implementation.createDocument("","", null);
Turn off asynchronous document loading to prevent the XML parser from attempting to continue with Javascript execution prior to the XML document being fully loaded by using the following code:
myXMLdoc.asynch="false";
Load the XML document into the Javascript parser with the following code:
myXMLdoc.load("myXMLFile.xml");
The XML file is now read and can be further manipulated as required for your web page.
Click on "File" and point to "Tools" on the drop-down menu. From the next-drop down menu, choose "Internet Options."
Click on the "Security" tab, then the "Internet Options" box. Click on the "Custom Level" button at the bottom of the box.
Scroll down nearly to the bottom in the "Security Settings" box until you see "Scripting." Under "Active Scripting," click on the radio button beside "Disable" to disable JavaScripting. Click the "OK" button at the bottom of the "Security Settings" box.
Select "Yes" on the pop-up box that asks "Are you sure you want to change the security settings for this zone?"
Click "OK" at the bottom of the "Internet Options" box to complete the changes.
Click on "Tools" at the top of the browser, then choose "Options."
Click on the "Content" icon in the "Options" box. Uncheck the box beside "Enable JavaScript."
Click "OK" at the bottom of the "Options" box to complete the changes.
Click on "Tools" at the top of your Opera browser, then mouse over to "Quick Preferences" to open the next drop-down menu.
Uncheck the box beside "Enable JavaScript." This completes the required changes.
Continue with your Internet session after the "Quick Preferences" box disappears.
Declare the variable. Type the following into your JavaScript code: var myVal = null;
This allocates memory and defines the variable for use.
Evaluate whether the variable is null. In some instances, you may want to execute code if the value is null. Wrap your executable code with this statement:
if (myVal== null) {
}
This statement provides a way to execute code only if myVal is null.
Evaluate whether a variable is not null. In other instances, you may want to run code when a value is not null. The "!" operator tells the compiler to run the statements if the result is false. In this statement, JavaScript runs statements if myVal is not null:
if (!name) {
}
Verify that the problem is machine specific. Try to duplicate the error on another machine; use a spare computer, your friend's or a co-worker's. If the error occurs on different computers, fixing the registry will not resolve the problem. Step 2 is optional (increase performance).
Go to http://www.eusing.com/free_registry_cleaner/registry_cleaner.htm and select "Download Option 1." A dialog box will appear, asking you to save the file. Click "Save File."
After the filed is saved, run the install application. A dialog box will recommend that you shut down all applications. Follow the program recommendation and close your applications; then select "Next." Accept the default settings by clicking "Next" until the installation process is complete.
Click "Finish" with the "Run Eusing Registry Cleaner" box checked. A dialog box will appear, asking you to register the product. Register or select the "Skip" option.
Click "Scan registry issue" from the top left menu under "Tasks." The program will scan your registry and look for problems. Typically hundreds of registry errors will be found.
Click "Repair registry issue" from the top left menu under "Tasks." After the program repairs the registry, a dialog box will appear. Close dialog box and program.
Verify that the Java script error problem is resolved by trying to duplicate the initial error. If your computer still generates the same error, contact technical support department at the place where you purchased your computer, or the computer's manufacturer.
Add a function called "confirmClick" to the JavaScript for your web page. This function will be used to confirm visitors want to leave the site when clicking on external links.
function confirmClick (url) {
Add the following code on a new line. "window.confirm" launches a confirmation box displaying the message passed to it as a parameter. When the visitor clicks one of the buttons, a value is assigned to the variable "answer."
var answer = window.confirm("Are you sure you want to leave this web page?")
Add the following code on the next lines of the script. If the visitor clicks "OK," the variable "answer" will hold the value "true." If "answer" is true, the action between the curly brackets {} will take place. In this case, the visitor's browser loads the Google website:
if (answer) {
window.location = url ;
}
Add the following code, finishing the function. If the visitor clicks "Cancel," the variable "answer" is "false" and the "else" action takes place. Here, an alert box will pop-up with a message.
else {
window.alert("Thank you for staying on this site!")
}
}
Wrap each external link on your web page with a call to the "confirmLink" function, like the following:
<a href="javascript:confirmClick('http://www.anothersite.com');">
An External Site</a>
Add a new function to the JavaScript for your web form page called "confirmSubmit." This function will be called from your form to confirm form submissions:
function confirmSubmit () {
Add the following code on a new line. "window.confirm" launches a confirmation box displaying the message passed to it as a parameter. When the visitor clicks one of the buttons, a value is assigned to the variable "answer."
var answer = window.confirm("Are you sure you want to continue?")
Add the following code to the next lines of the script, finishing the function. If your visitor clicks "OK," the "confirmSubmit" function returns "true." If your visitor clicks "Cancel," the function returns "false."
if (answer) {
return true ;
}
else {
return false ;
}
}
Add an onClick attribute to each submit button in your form you want a confirmation box to pop-up for when clicked similar to the following. The button only submits the form when "confirmSubmit" returns "true."
<input type="Submit" name="Submit" onClick="return confirmSubmit();">
Open your web page in Dreamweaver (or create a new one by selecting "File | New" and choosing "HTML").
Insert the standard button image into your page by selecting "Insert | Image" and choosing the image file. If you get the message "Would you like to copy the file to your document folder now?" click "Yes" and follow the instructions to save a copy of the image file.
Click on the standard button image to select it. The image will be surrounded by a border with resize handles when selected.
Open the Behaviors palette by selecting "Window | Behaviors."
Click the "Add Behavior" button (the plus sign "+") at the top of the palette. Select "Swap Image" from the drop-down menu. The "Swap Image" window appears.
Click the "Browse" button, select your highlight button image file and click "OK." If you get the message "Would you like to copy the file to your document folder now?" click "Yes."
Check the "Preload Images" and "Restore Images onMouseOut" checkboxes. Preloading images improves the speed and performance of the rollover image effect. Restoring images onMouseOut adds a behavior to set the button to the original standard button image when your mouse cursor moves off the image.
Click "OK." Note there are two listings on the Behaviors palette. The "Swap Image" behavior is assigned to the "onMouseOver" event for the image. The "Swap Image Restore" behavior is assigned to the "onMouseOut" event.
Save your web page.
Preview your web page and test the effect by moving your mouse cursor over the button. When your mouse cursor hovers over the button, the highlight button image should appear. When you move your mouse cursor off the button, the standard button image should be restored.
Open Dreamweaver to the webpage on which you want to call up Java Script.
Select the element on the webpage to which you want to apply the Java Script; this can be text, an image or a link. Make sure that the element in its entirety is highlighted.
Click on the "Behaviors" tab. This will open up the "Behaviors" window. Within the "Behaviors" window, click on the "Plus" sign located near the top of the window. This will open up the "Actions" menu.
Click on the "Call Java Scrip" option in the "Actions" menu. Insert the desired Java Script into the box that will appear. Once you are finished, click the "OK" button.
Launch your Adobe Dreamweaver application and begin a new page or open an existing one by clicking "New" or "Open" under the "File" drop-down menu.
Insert an object by clicking the "Insert" menu and then select an option like "Image Placeholder" from the "Image Objects" list.
Click the object on the design window and then click the plus sign button under the "Behaviors" panel tab. If this option is not visible, select "Behaviors" under the "Window" drop-down menu.
Click the "Call JavaScript" option and then enter your code or the name of a function in the provided text field. Alternately, you can use a built-in behavior, such as "Go To URL," by selecting this option from the "Actions" menu on the "Behaviors" window. Click the "OK" button when done.
Repeat step one from the previous section.
Place your cursor in the area in the code window where you want your JavaScript link to appear.
Select "HTML" from the "Insert" menu and then navigate to "Script Objects" and "Script."
Select an option, such as "text/javascript," from the "Type" drop-down menu and then click the folder next to the "Search" field to select your JavaScript document. Alternately, you can enter your JavaScript in the "Content" text field. Click the "OK button when done.
Launch your Adobe Dreamweaver application and create a new page or open an existing one.
Place your cursor in the code view where you want to call up the JavaScript file.
Click the "HTML" option from the "Insert" drop-down menu and then go to "Script Objects" and select "Script."
Choose an option like "text/x-javascript" in the "Type" drop-down menu and then click the folder to select the JavaScript file. This action automatically generates the hyperlink in your page code. Click the "OK" button when done.
Click "Save" or "Save As" under the "File" menu to save your document.