papillonstudios Posted June 12, 2011 Share Posted June 12, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/239169-links-dont-work/ Share on other sites More sharing options...
cssfreakie Posted June 12, 2011 Share Posted June 12, 2011 you have a # inside them instead of a url for example: <a href="#">Top Players</a> Quote Link to comment https://forums.phpfreaks.com/topic/239169-links-dont-work/#findComment-1228823 Share on other sites More sharing options...
papillonstudios Posted June 12, 2011 Author Share Posted June 12, 2011 but the thing is it wont even add the "#" to the url in the address bar Quote Link to comment https://forums.phpfreaks.com/topic/239169-links-dont-work/#findComment-1228826 Share on other sites More sharing options...
cssfreakie Posted June 12, 2011 Share Posted June 12, 2011 do you have an online example? easier to see what is going wrong for me. Beides that some of your #id's start with a number, that is invalid. #1, #2, #3 Quote Link to comment https://forums.phpfreaks.com/topic/239169-links-dont-work/#findComment-1228830 Share on other sites More sharing options...
papillonstudios Posted June 12, 2011 Author Share Posted June 12, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/239169-links-dont-work/#findComment-1228832 Share on other sites More sharing options...
cssfreakie Posted June 12, 2011 Share Posted June 12, 2011 do you have an online example? easier to see what is going wrong I don't see anything other that pops out... do you have an online example? easier to see what is going wrong Quote Link to comment https://forums.phpfreaks.com/topic/239169-links-dont-work/#findComment-1228833 Share on other sites More sharing options...
gizmola Posted June 12, 2011 Share Posted June 12, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/239169-links-dont-work/#findComment-1228835 Share on other sites More sharing options...
papillonstudios Posted June 12, 2011 Author Share Posted June 12, 2011 I didn't upload all the images http://gamingfusion.net/magic/ Quote Link to comment https://forums.phpfreaks.com/topic/239169-links-dont-work/#findComment-1228840 Share on other sites More sharing options...
cssfreakie Posted June 12, 2011 Share Posted June 12, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/239169-links-dont-work/#findComment-1228843 Share on other sites More sharing options...
papillonstudios Posted June 15, 2011 Author Share Posted June 15, 2011 the way Im doing it is calling a javascript function I can use over and over. function redirect(url) { window.location = url; } Quote Link to comment https://forums.phpfreaks.com/topic/239169-links-dont-work/#findComment-1230066 Share on other sites More sharing options...
cssfreakie Posted June 15, 2011 Share Posted June 15, 2011 As posted previous change the order of the li's as described above and it is fixed. Quote Link to comment https://forums.phpfreaks.com/topic/239169-links-dont-work/#findComment-1230120 Share on other sites More sharing options...
zeneth Posted June 25, 2011 Share Posted June 25, 2011 Try <a href="your site">the keyword</a> Quote Link to comment https://forums.phpfreaks.com/topic/239169-links-dont-work/#findComment-1234612 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.