codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  java button problem  dnew at 15:31 on Tuesday, February 15, 2005
 

Im not sure if htis is the right forum, so i'll apologise in advance;
Basically, i have an html page, i have created a html form containing a text box which takes a url and a button which passes this url to an applet (on the same page) and then displays this url on the applet.
Currently this is all my applet does-display the URL from the form ,however i have added a button to the applet and i want to be able to click on this button and open the URL in the same window.
Does anyone know how to do this?

This is my code do far:

HTML:
<form name="f1">
<b>Enter a website:p>
<input type="text" size="50" name="inurl">
<input type="button" value="Request URL" id="suburl" onClick="return validurl();">
</form>

<applet codebase="." code="javacode.class"
<param name="inurl" value="">
</applet>



JAVA:
public class javacode extends Applet
{
private Button clickButton;
String URL;

public void init()
{
URL = getParameter("inurl");

clickButton = new Button("Show URL");

}


public void updateURL(String newURL)
{
URL = newURL;
repaint();
}

public void paint(Graphics g)
{
g.drawString(URL,50 ,50);
}



© Copyright codetoad.com 2001-2005