Toymods Car Club
www.toymods.org.au
F.A.Q. F.A.Q.    Register Register    Login Login    Home Home
Members Members    Search Search
Toymods » The Outhouse » Anyone know javascript?

Show: Today's Posts  :: Show Polls 
Email to friend 
Return to the default flat view Create a new topic Submit Reply
AuthorTopic
Mx73_LuXoBarge
Regular


Location:
Bris-vague-us
Registered:
October 2002
Re: Anyone know javascript? Thu, 08 September 2005 22:32 Go to previous message
Norbie wrote on Thu, 08 September 2005 23:44

I
He wanted a button - not a link, and not a link that looks like a button, but an actual button. Smile


He wanted a button, but his assignment is to link two web pages. His interpretation of the task at hand was incorrect, hence why I felt the need to set the record straight before another person starting adding garbage code to the web Wink


Ok, you want a form that links to another page? sure...
<?php
if(isset($_POST['target'])) 
    header('Location:'.$_POST['target']);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd&q uot;>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-au">
<title>Google Page Jump</title>
<script type="text/javascript">
function pageJump(id) {
	var form, targURL;
	form = document.getElementById(id);
	targURL = form.getElementsByTagName('input')[0].value;
	window.location = targURL;
	return false;
}
</script>
<style type="text/css"
</head>
<body>
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="pJump" onsubmit="return pageJump('pJump');" >
		<fieldset>
			<legend>Google Jump</legend>
			<input type="hidden" name="target" value="http://google.com/">
			<input type="submit" value="Go to Google">
		</fieldset>
	</form>
</body>
</html>


That page requires a PHP server to function correctly, but it will work in every browser ever made. Change the input type="hidden" to type="text" and suddenly the user can enter in the address they want to visit. Hoorah. Neutral

Norbie: Event handlers do not require the javascript: protocol. In fact, the javascript: protocol was never part of a formal standard and as such is merely a "hack that still works".
You should be attaching events using DOM2 methods. Have a search on 'unobtrusive scripting' if you want more details Smile
  Send a private message to this user    

SubjectPosterDate
Read Message   Anyone know javascript? Smokey228Wed, 07 September 2005 06:47
Read Message   Re: Anyone know javascript? ehendrikdWed, 07 September 2005 06:59
Read Message   Re: Anyone know javascript? NorbieWed, 07 September 2005 07:00
Read Message   Re: Anyone know javascript? ShrakaWed, 07 September 2005 07:04
Read Message   Re: Anyone know javascript? Vee_469Wed, 07 September 2005 14:42
Read Message   Re: Anyone know javascript? NorbieWed, 07 September 2005 23:52
Read Message   Re: Anyone know javascript? ShrakaThu, 08 September 2005 00:57
Read Message   Re: Anyone know javascript? Vee_469Thu, 08 September 2005 04:47
Read Message   Re: Anyone know javascript? NorbieThu, 08 September 2005 01:44
Read Message   Re: Anyone know javascript? MR. 2Thu, 08 September 2005 02:03
Read Message   Re: Anyone know javascript? ShrakaThu, 08 September 2005 03:11
Read Message   Re: Anyone know javascript? Mx73_LuXoBargeThu, 08 September 2005 10:48
Read Message   Re: Anyone know javascript? NorbieThu, 08 September 2005 13:44
Read Message   Re: Anyone know javascript? thechucksterThu, 08 September 2005 14:24
Read Message   Re: Anyone know javascript? thu187Thu, 08 September 2005 16:12
Read Message   Re: Anyone know javascript? Mx73_LuXoBargeThu, 08 September 2005 23:07
Read Message   Re: Anyone know javascript?  Mx73_LuXoBargeThu, 08 September 2005 22:32
Previous Topic:avatar
Next Topic:go outside and look at the moon right now!

Goto Forum:
-=] Back to Top [=-

Current Time: Sat Jan 11 02:15:11 UTC 2025

Total time taken to generate the page: 0.010884046554565 seconds

Bandwidth utilization bar

.:: Contact :: Home ::.

Powered by: FUDforum 2.3.8
Copyright ©2001-2003 Advanced Internet Designs Inc.