0

This is a really frustrating problem... I have made an HTML5 button styled with CSS3 - this button works (functionally) in I.E, but when I open my page in Firefox (v 16.0.2) the button does not work (e.g you can't click on it - it does nothing). What is even weirder is that I put a standard a href link just for testing (on the same page, beside the button), and I can't even click on that (e.g it does nothing). I have tested this page on two different machines in both I.E 9 and FireFox 16.0.2.

Here is the HTML code for my button:

<p><button type="button" onClick="location.href='index.php'" class="navigationButton">Back to World Map</button> 

<!-- test link -->
<a href="index.php">home</a></p>

And the CSS:

.navigationButton {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 18px;
    color: #ffffff;
    padding: 10px 20px;
    background: -moz-linear-gradient(
        top,
        #86eb86 0%,
        #013006);
    background: -webkit-gradient(
        linear, left top, left bottom, 
        from(#86eb86),
        to(#013006));
    background: -ms-linear-gradient(#86eb86, #013006);
    background: -o-linear-gradient(#86eb86, #013006);
    background: linear-gradient(#86eb86, #013006);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#86eb86', endColorstr='#013006');

    -moz-border-radius: 15px;
    -webkit-border-radius: 15px;
    border-radius: 15px;
    border: 3px solid #171717;
    -moz-box-shadow:
        0px 1px 3px rgba(000,000,000,0.5),
        inset 0px 0px 10px rgba(087,087,087,0.7);
    -webkit-box-shadow:
        0px 1px 3px rgba(000,000,000,0.5),
        inset 0px 0px 10px rgba(087,087,087,0.7);
    box-shadow:
        0px 1px 3px rgba(000,000,000,0.5),
        inset 0px 0px 10px rgba(087,087,087,0.7);
    text-shadow:
        0px -1px 0px rgba(000,000,000,0.4),
        0px 1px 0px rgba(255,255,255,0.3);
}

If my implementation of this button works for anyone else (in both I.E and Firefox), please let me know - otherwise if I have done something wrong, also let me know with an explanation.

Cheers!

EDIT: Here is the complete code for one of the pages. It is dynamically generated by PHP/MySQL...

<?php

require_once("includes/dbconnect.php");

$title = "";
$regionName = "";
$mapScript = "";
$mapDivStyle = "";
$pageDimensions = "";
$footerMargin = "";

function numberFormat($item){

    return number_format($item, 0, '.', ',');
}

if(isset($_GET['region'])){
 $region = htmlentities($_GET['region']);

 if($region == "northAmerica")
 {
     $regionName = "North America";
     $title = $regionName . ' | WorldTravel Tourism App';
     $mapScript = "js/northAmerica.js";
     $mapDivStyle = " style=\"width: 800px; height: 707px; margin-bottom:20px;\"";
     $pageDimensions = " style=\"width: 960px; height: 1050px;\"";
     $footerMargin = " style=\"margin-top:1159px;\"";
 }
 else if($region == "southAmerica")
 {
     $regionName = "South America";
     $title = $regionName . " | WorldTravel Tourism App";
     $mapScript = "js/southAmerica.js";
     $mapDivStyle = " style=\"width: 800px; height: 668px; margin-bottom:20px;\"";
     $pageDimensions = " style=\"width: 960px; height: 950px;\"";
     $footerMargin = " style=\"margin-top:1059px;\"";
 }
 else if($region == "eurasia")
 {
     $regionName = 'Eurasia';
     $title = $regionName . " | WorldTravel Tourism App";
     $mapScript = "js/eurasia.js";
     $mapDivStyle = " style=\"width: 800px; height: 415px; margin-bottom:20px;\"";
     $pageDimensions = " style=\"width: 960px; height: 900px;\"";
     $footerMargin = " style=\"margin-top:1009px;\"";
 }
 else if($region == "africaMiddleEast")
 {
     $regionName = "Africa and the Middle East";
     $title = $regionName . " | WorldTravel Tourism App";
     $mapScript = "js/africaMiddleEast.js";
     $mapDivStyle = " style=\"width: 800px; height: 799px; margin-bottom:20px;\"";
     $pageDimensions = " style=\"width: 960px; height: 1150px;\"";
     $footerMargin = " style=\"margin-top:1259px;\"";
 }
 else if($region == "oceania")
 {
     $regionName = 'Oceania';
     $title = $regionName . " | WorldTravel Tourism App";
     $mapScript = "js/oceania.js";
     $mapDivStyle = " style=\"width: 738px; height: 527px; margin-bottom:20px;\"";
     $pageDimensions = " style=\"width: 960px; height: 800px;\"";
     $footerMargin = " style=\"margin-top:859px;\"";

 }
 else{
     $invalidRegion = $region;
     $title = "Region not found | WorldTravel Tourism App";
 }
}
else{
    header("Location: index.php");
}
?>
<!DOCTYPE HTML>
<html>
    <head>
        <title><?php echo($title); ?></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <link href="css/styles.css" rel="stylesheet" type="text/css">
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
        <script type="text/javascript" src="Scripts/swfobject.js"></script>
        <script type="text/javascript" src="<?php echo ($mapScript) ?>"></script>
    </head>

    <body>

        <div class="container">

          <header class="header">
          <p style="margin-left:-14px;"><img src="images/world_globe.png" class="headerImage" alt="World Globe" /></p>
          <p style="margin-top:-150px; margin-left:150px; color:white; font-family:'Comic Sans MS', cursive; font-weight:bold; font-size:35px;">WorldTravel Global Tourism Application</p>
          </header>

          <div class="content"<?php echo ($pageDimensions); ?>>
            <h1><?php echo($regionName); ?></h1>

            <?php

            if(isset($invalidRegion)){
                echo ("<p>Sorry, the region \"$invalidRegion\" is not valid</p>");
            }

            ?>

            <?php if(isset($region)){ ?>
            &nbsp;
            <div id="flashContent" <?php echo $mapDivStyle; ?>>
            </div>   
            <?php } ?>
            <p></p>
            <?php

            if(!isset($invalidRegion)){

                $query = "SELECT * FROM region WHERE region.regionID = (SELECT region.regionID from region WHERE region.regionName = '$region');";

                $result = mysql_query($query, $connection);
                $row = mysql_fetch_assoc($result);
                $regionPopulation = numberFormat($row['regionPopulation']);
                $regionLandArea = numberFormat($row['regionLandArea']);
                $populationDensity = round((($row['regionPopulation'])/($row['regionLandArea'])), 2);
                $regionCountries = $row['regionCountries'];
                $numberPrefix = "";

                echo("<p><span class=\"infoHeadings\">Region population:</span> " . $regionPopulation . ".</p>");
                echo("<p><span class=\"infoHeadings\">Region land area:</span> " . $regionLandArea . " square kilometers.</p>");
                echo("<p><span class=\"infoHeadings\">Population density:</span> " . $populationDensity . " people per square kilometer.</p>");
                echo("<p><span class=\"infoHeadings\">Countries in region:</span> " . $regionCountries . ".</p>");


            }
            ?>


            <p><button type="button" onClick="location.href='index.php';" class="navigationButton">Back to World Map</button><p> 

            <!-- test link -->
            <p><a href="index.php">home</a></p>


          </div>


          <div class="footer"<?php echo ($footerMargin); ?>>
          </div>
        </div>
    </body>
</html>
Rob
  • 1,272
  • 6
  • 24
  • 35
  • Try adding a semicolon to complete the JS statement: onClick="location.href='index.php';" Also, make sure you have closed all other tags that have been opened (I had that problem once), and that you define `` and ``. –  Nov 05 '12 at 00:44
  • works fine in my Firefox 17 (beta) - even as it is without other tags like ``... – Aprillion Nov 05 '12 at 00:53
  • What version of Firefox are you running? – recursion.ninja Nov 05 '12 at 00:54
  • @awashburn read the question, its 16.0.2 – Aprillion Nov 05 '12 at 00:56
  • what is the **url** of your test page? i hope not `index.php` (what would be the point of reloading the page itself with the same GET request as the 1st time..) – Aprillion Nov 05 '12 at 01:01
  • @deathApril Yes, the page for the test link is "index.php"... The button is meant to go back to the homepage (index.php) in this case. – Rob Nov 05 '12 at 01:06
  • I also ran the html source of the page through the w3c validator and I get no errors... – Rob Nov 05 '12 at 01:07
  • @Rob this might help - http://stackoverflow.com/q/2624111/1176601 – Aprillion Nov 05 '12 at 01:10
  • @deathApril An example url of the test page is http://localhost/multimedia_final_project/page.php?region=northAmerica. Would you like me to upload the files and source the database onto the server? – Rob Nov 05 '12 at 01:17
  • @Rob ok, i meant "this" page url when asking for the "test" page url - they are different, so it seems the problem is somewhere else - it works in my firefox and don't know why not in yours :( – Aprillion Nov 05 '12 at 01:24

1 Answers1

2

It turns out that z-indexing of one of my elements was the issue. On my page, I had my footer div with a z-index of 20 and a top margin of 500px, and the main content area had a lower z-index value (where the button resided). Because the margin area was "covering" the button, I was not able to click on any link or button in the main content area.

So I've fixed the problem, although I am still wondering why FireFox didn't read the z-indexing and I.E did - I used Google's html5shiv to enable html5 elements in older versions of I.E).

Rob
  • 1,272
  • 6
  • 24
  • 35