LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-13-2006, 07:28 PM   #1
paul_mat
Member
 
Registered: Nov 2004
Location: Townsville, Australia
Distribution: Fedora Core 5, CentOS 4, RHEL 4
Posts: 855

Rep: Reputation: 30
help with javascript function


hi there,

i was wondering if someone could provide me with a basic java function that when called on would take me to a website? such as www.linuxquestions.org
 
Old 02-14-2006, 02:36 PM   #2
Dudydoo
Member
 
Registered: Sep 2003
Location: UK
Distribution: I use 'em all ;-)
Posts: 275

Rep: Reputation: 38
Code:
<html>
	<head>
		<script language="javascript">
			function goToUrl(URL)
			{
				window.open(URL);
			}
			
		</script>
	</head>
	<body>
		
		<input type=button value="Click me!" onclick=goToUrl("http://www.yahoo.com")>
	</body>
</html>
 
Old 02-14-2006, 06:07 PM   #3
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 51
Quote:
Originally Posted by paul_mat
a basic java function
you mean javascript (from your title)? java and javascript are completely unrelated things
 
Old 02-15-2006, 12:48 PM   #4
german
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Debian etch, Gentoo
Posts: 312

Rep: Reputation: 30
If you really mean Java and not JavaScript, then the method you tell an Applet to open a URL is like this:

Code:
AppletContext context = getAppletContext(); // assuming the object you're writing this in extends Applet or JApplet
URL url = new URL("http://www.linuxquestions.org");
context.showDocument(url);
HTH

B.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
passing php string to javascript function djgerbavore Programming 2 03-01-2005 11:34 AM
expandIt function in JavaScript: COOL menus xbaez Programming 0 02-13-2005 06:36 PM
returning an array from a function.. javascript sonesay Programming 1 06-07-2004 05:28 AM
A main can be changed by a function local without passing anything to the function? ananthbv Programming 10 05-04-2004 01:31 PM
Perl exec function in linux (and system-function) nazula Programming 1 04-19-2004 12:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration