Friday, July 21, 2017

Modern web pages

Modern web pages 


Modern web pages contain various dynamic content that covers the use of HTML, Javascript, and Java. I have recently prepared a website for all of these elements to work at a concert, to "talk" to each other. Specifically, there was a Java applet that featured a text page and a rollover button with a "printer" symbol; When the user clicks the button, I want the applet to print the text. If you want to have a similar effect on your website, it is the solution.

To get started, encode your Java applet normally. There is nothing else but a publicity assignment. For example, a simple message that displays a message box that shows any text that goes to the szMessage parameter for the user.

Public testMe (String szMessage) {
JOptionPane: showMessageDialog (null, szMessage, "Hi!", JOptionPane.INFORMATION_MESSAGE);
}

Create your Java file and enter your webpage using standard HTML tags. (At this point, if you are using a code obfuscator like Proguard, you must indicate the name of the function after the markup process).

Now, create an HTML hyperlink in the form to call this command from Java:

<a target="_new" rel="nofollow" href="javascript:document.applets%5B0%5D.testMe("> Click here to call the Java function. </ A>

For those who are not familiar with HTML, this code looks like a standard HTML link. However, instead of changing the page, whenever a user clicks on the link, the browser runs a piece of Javascript code. Javascript: prefix shows the implementation of the browser Javascript; Document.applets [0] define the applet to "speak" (in this case it is likely that this will be the first application in this document); This is finally followed by any parameter you want to pass, including the Java function name.

When a user clicks on the link, the correct Java function will be performed, in which case a message box will be displayed. As a last resort, with more stringent security settings, some browsers limit the Java applet capability of Javascript "scripts" and may require some support for the user to do so.

0 comments:

Post a Comment