Jump to content

links dont work


papillonstudios

Recommended Posts

ok Im doing a javascript project for school, but for some reason my links are not working.

 

What I mean is I can click them and nothing happens. They are pointed to different pages but it doesn't change.

 

heres my code:

 

index.php

<!DOCTYPE HTML>
<html>
<head>
<title>Magic: The Gathering Community Tournment</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="cssreset.css">
<script type="text/javascript" src="javascript.js"></script>
<script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="jquery.easing.min.js"></script>
    <script type="text/javascript" src="jquery.lavalamp.min.js"></script>
    <script type="text/javascript">
        $(function() {
            $("#1, #2, #3").lavaLamp({
                fx: "backout",
                speed: 700,
                click: function(event, menuItem) {
                    return false;
                }
            });
        });
    </script>
</head>
<body>

<div id="loginBox">
	<h2>Login</h2>
	<form action="login.php" method="post">
		<table>
			<tr>
				<td>Email: </td><td><input type="email" name="email" /></td>
			</tr>
			<tr>
				<td>Password: </td><td><input type="password" name="passsword" /></td>
			</tr>
			<tr>
				<td><input type="submit" name="submit" value="Submit" /></td>
			</tr>
		</table>
	</form>
</div>

<div id="wrapper">

	<div id="logo">
		<img src="i/logo.png" alt="Logo" />
	</div>

	<div id="navigation">
		<ul class="menu" id="2">
    			<li class="current"><a href="index.php">Home</a></li>
    			<li><a href="play.php" target="_self" >Play!</a></li>
    			<li><a href="#" id="account" onclick="showElement('pageOverlay', 'loginBox')">My Account</a></li>
    			<li><a href="#">Members</a></li>
    			<li><a href="#">Top Players</a></li>
    			<li><a href="#">Logout</a></li>
		</ul>
	</div>

	<div id="contentContainer">

		<div id="breadCrumb">
			Home
		</div>

		<div id="features">
			<table style="position:relative;">
				<tr>
					<td>
						<div id="widget1">
							<a href="#"><img src="i/widget1.jpg" alt="Play Now!" /></a>
						</div>
					</td>
					<td>
						<div id="widget2">
							<a href="#"><img src="i/widget2.jpg" alt="Join Today!" /></a>
						</div>
					</td>
				</tr>
			</table>
		</div>	
		<div id="video">
			<table>
				<tr>
					<td>
						<img src="i/youtube.jpg" alt="YouTube" />
					</td>
					<td id="videoTxt">
						<img src="i/videoTxt.jpg" alt="Watch How-To Video" />
					</td>
				</tr>
			</table>
		</div>

		<!--END OF contentContainer -->
	</div>

</div>
</body>
</html>

 

javascript.js

onload = createElements;

function createElements()
{
createOverlay();
createLoginBox();
}

function createOverlay()
{
var pageOverlay = document.createElement("div");
pageOverlay.id = "pageOverlay";
pageOverlay.onclick = function()
{
	document.getElementById("pageOverlay").style.display = "none";
	document.getElementById("loginBox").style.display = "none";
}

document.body.appendChild(pageOverlay);
}

function createLoginBox()
{
var loginBox = document.getElementById("loginBox");
loginBox.id = "loginBox";

document.body.appendChild(loginBox);
}

function showElement(id, id2)
{
document.getElementById(id).style.display = "block";
document.getElementById(id2).style.display = "block";
}

 

im also using the Lavalamp Javascript script for the menu.

Link to comment
https://forums.phpfreaks.com/topic/239169-links-dont-work/
Share on other sites

the links that have index.php and play.php as the anchor dont go to mydomain.com/index.php or  mydomain.com/play.php they stay mydomain.com when I click them

 

Sounds like a configuration issue with your host.  Use firebug to look at the net console and see what is happening when you click on the link.

Link to comment
https://forums.phpfreaks.com/topic/239169-links-dont-work/#findComment-1228835
Share on other sites

place the <li> that the javascript is using above the other <li>'s

So that is the one with class is 'back'

 

<ul id="2" class="menu">
        <li class="back" style="left: 72px; width: 61px; overflow: hidden;"><div class="left"></div</li>
    	<li class="current"><a href="#">Home</a></li>
    	<li><a target="_self" href="play.php">Play!</a></li>
    	<li><a onclick="showElement('pageOverlay', 'loginBox')" id="account" href="#">My Account</a></li>
    	<li><a href="#">Members</a></li>
    	<li><a href="#">Top Players</a></li>
    	<li><a href="#">Logout</a></li>
</ul>

 

 

Besides that rename your ID never start with a number

 

*mark it solved when fixed please, cheers!

 

cssfreakie

 

P.s i just copy pasted it, all you need to do is change the order of the original <li>'s like above, nothing more the inline values are inherited from the javascript.

Link to comment
https://forums.phpfreaks.com/topic/239169-links-dont-work/#findComment-1228843
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.