Click to See Complete Forum and Search --> : Can you use a javascript to display a java applet?
22learn
October 26th, 2006, 09:44 AM
I have been searching for a javascript that will allow me to:
have a window for image display and text links next to it that once clicked, open the image associated with the text link in the window...so as to keep everything on one web page.
However, I'm not actually displaying a still image, I'm displaying virtual tours developed with java applet. So I have <applet> tags and not just an img source code.
Is this possible?
I found one that allowed html in a <div> code so I placed the html for the <applet> to run and it locks up the page in the browser.
Can anyone lead me in a direction or let me know if this is even possible.
Thanks
PeejAvery
October 26th, 2006, 12:07 PM
Inside the DIV is correct for what you want.
Can you please post your code test. It is possible that something is wrong causing the browser to lock up.
22learn
October 26th, 2006, 01:07 PM
http://www.tygartlake.com/newsite/tours/tours.htm
Thanks for taking a look.
PeejAvery
October 26th, 2006, 01:48 PM
Okay, I would suggest a different approach. Right now you are loading all the Java applets. That is a lot.
I suggest using 1 DIV and dynamically changing the content with each onchange event of the SELECT tag.
<script language="JavaScript">
function changeDIV(v){
newcontent = "<APPLET CODE='hm35.class' NAME='HotMedia' WIDTH='352' HEIGHT='217'>";
newcontent += "<PARAM NAME='mvrfile' value='" + v + "'>";
newcontent += "<PARAM NAME='ShowALink' value='y'>";
newcontent += "</APPLET>";
document.getElementById('appdiv').innerHTML = newcontent;
}
</script>
<select onchange="changeDIV(this.id)">
<option value="lodgeroom.mvr">Lodgeroom</option>
<option value="suite.mvr">Executive Suite</option>
...
</select>
<div id="appdiv"></div>
22learn
October 27th, 2006, 09:37 AM
http://www.tygartlake.com/newsite/tours/tours2.htm
Implemented your solution and it says that the applet is started but the tour never appears...?
PeejAvery
October 27th, 2006, 10:38 AM
Interesting. I wonder if it has to do with the Java class. Okay, so instead of using a div, try an iframe. I did not test the code below, but it looks correct.
<script language="JavaScript">
function changeFrame(v){
newcontent = "<APPLET CODE='hm35.class' NAME='HotMedia' WIDTH='352' HEIGHT='217'>";
newcontent += "<PARAM NAME='mvrfile' value='" + v + "'>";
newcontent += "<PARAM NAME='ShowALink' value='y'>";
newcontent += "</APPLET>";
document.getElementById('iFrame').document.write(newcontent);
}
</script>
<select onchange="changeFrame(this.id)">
<option value="lodgeroom.mvr">Lodgeroom</option>
<option value="suite.mvr">Executive Suite</option>
...
</select>
<iframe width=0 height=0 frameborder=0 src="about"blank" id="iFrame"></iframe>
22learn
October 27th, 2006, 12:34 PM
Ok, thanks but I put this in:
http://www.tygartlake.com/newsite/tours/tour3.htm
And ......well, you'll see what happens.
this is the link to how the tours are displayed now, thought this might help you. And also, we don't have to have the drop down box option, there could still be text links to run each applet in the same window on the same page.
http://www.tygartlake.com/tour/lodgeroom.htm
PeejAvery
October 27th, 2006, 12:49 PM
Ok, thanks but I put this in:
http://www.tygartlake.com/newsite/tours/tour3.htm
And ......well, you'll see what happens.
Page cannot be found.
22learn
October 30th, 2006, 09:13 AM
http://www.tygartlake.com/newsite/tours/tours3.htm
PeejAvery
October 30th, 2006, 09:57 AM
That is because I had a typo. I wrote about"blank instead of about:blank.
<iframe width=0 height=0 frameborder=0 src="about:blank" id="iFrame"></iframe>
22learn
October 30th, 2006, 01:46 PM
1) it takes you to a "new" page that would display the tour only and not keep you in the rest of the web site.
2) the tour doesn't view...continues to just say in toolbar that "Applet is started"
http://www.tygartlake.com/newsite/tours/tours3.htm
PeejAvery
October 30th, 2006, 05:59 PM
I guess Java does not like to be written dynamically. I guess you are going to have to make a DIV for each one and just hide/show them as necessary.
22learn
October 31st, 2006, 10:13 AM
I wish I knew how to do what you suggest.
Are you saying I need to go back to the original code when all the applets loaded at once?
Do you know of an example?
Thanks for all your help.
PeejAvery
October 31st, 2006, 10:44 AM
Are you saying I need to go back to the original code when all the applets loaded at once?
Unfortunately, that is what it seems. I know JavaScript, but not Java. It seems that they don't like each other.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.