Welcome to WebmasterWorld Guest from 54.196.238.210

Forum Moderators: open

Message Too Old, No Replies

How to insert Java on a webpage

How can i insert Java on a web page

     

lixsmk1

12:39 pm on Sep 4, 2009 (gmt 0)

5+ Year Member



Hi,
I want to insert a java code on my webpage. Can you please let me know how to do that and where to put the code and what will be the start and ending codes wrapping the main java code, thanks.

jackhack

4:22 pm on Sep 4, 2009 (gmt 0)

5+ Year Member



Well basically you want to create an Applet, which is a java program called with HTML coding.

I am stuck with displaying my applet and need help aswell.

whoisgregg

4:52 pm on Sep 4, 2009 (gmt 0)

WebmasterWorld Senior Member whoisgregg is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Java and JavaScript are two very different things. JavaScript can be included like so:

<script type="text/javascript">
// <![CDATA[
alert('Your code here!');
// ]]>
</script>

Whereas a Java Applet is an external file and is embedded in a document much like a Flash movie. The simplest form of this (according to Sun's documentation) looks like:

<applet code="Applet1.class" width="200" height="200">
Your browser does not support the applet tag.
</applet>

Fotiman

11:02 pm on Sep 4, 2009 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



And as for JavaScript, it's generally best practice to put it in an external file and include it like so (vs. including the JavaScript code in the HTML page):


<script type="text/javascript"
src="yourJavaScriptFile.js"></script>

lixsmk1

11:45 pm on Sep 4, 2009 (gmt 0)

5+ Year Member



Well i was provided with a java script code and asked to put it anywhere on a live page to check the status if it work. It is a chat option for technical help. I did include it in to the source code but after i saved the file it seems to have shift from the place i saved it but still appears on the page in source code.Though i can't see it on the front end...? any guesses will it still work for me or do i have to do something else. cheers

lixsmk1

8:51 am on Oct 22, 2009 (gmt 0)

5+ Year Member



any guesses? any one

phranque

9:15 am on Oct 22, 2009 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



did you try putting the javascript code in the script tag as described by whoisgregg?

lixsmk1

11:59 am on Oct 23, 2009 (gmt 0)

5+ Year Member




Right this is an example of the xact thing...how do i make it work on my site...do i just need to copy paste this code on a live page or do something else to make it work ?

<!-- meer HELP CODE BEGIN-->
<link href="http://abc.000.000.dw/css/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="http://www."></script>
<script language="javascript" src="http://abc.000.000.dw/meer.js"></script>
<script language="javascript">
var button_type = BUTTON_TYPE_IMAGE;
var online_display = "http://abc.000.000.dw/img/online.jpg";
var offline_display = "http://abc.000.000.dw/img/offline.jpg";
var button_assign_type = BUTTON_ASSIGN_NULL;
var chat_window_skin ="blue";
var chat_window_width = 495;
var chat_window_height = 495;
var enable_invitation = true;
var invitation_popup_type = INVIATION_STYLE_SLIDEDOWN;
var invitation_skin = INVIATION_STYLE_BLUE;
var invitation_dept_id = 1;
var define_url = "http://abc.000.000.dw";
livehelp();
</script>
<!-- meerHELP CODE END-->

Regards

phranque

4:31 pm on Oct 23, 2009 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



you should be able to paste that in the <head> of the document(s).

in some cases it may help page rendering speed to move the script tags to just before the </body> tag, but it should work ok in the head.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month