Welcome to WebmasterWorld Guest from 23.20.12.34

Forum Moderators: open

Message Too Old, No Replies

How to insert Java on a webpage

How can i insert Java on a web page

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

New User

5+ Year Member

joined:Dec 12, 2008
posts:32
votes: 0


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.
4:22 pm on Sept 4, 2009 (gmt 0)

New User

5+ Year Member

joined:Sept 4, 2009
posts: 2
votes: 0


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.

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

Senior Member from US 

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

joined:Dec 9, 2003
posts:3416
votes: 0


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>
11:02 pm on Sept 4, 2009 (gmt 0)

Senior Member from US 

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

joined:Oct 17, 2005
posts:4988
votes: 12


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>
11:45 pm on Sept 4, 2009 (gmt 0)

New User

5+ Year Member

joined:Dec 12, 2008
posts:32
votes: 0


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
8:51 am on Oct 22, 2009 (gmt 0)

New User

5+ Year Member

joined:Dec 12, 2008
posts:32
votes: 0


any guesses? any one
9:15 am on Oct 22, 2009 (gmt 0)

Administrator

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

joined:Aug 10, 2004
posts:10553
votes: 13


did you try putting the javascript code in the script tag as described by whoisgregg?
11:59 am on Oct 23, 2009 (gmt 0)

New User

5+ Year Member

joined:Dec 12, 2008
posts:32
votes: 0



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

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

Administrator

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

joined:Aug 10, 2004
posts:10553
votes: 13


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.