Xampp不读取javascript(并且在webhost上一切正常)

时间:2017-06-02 23:10:25

标签: javascript php html

今天我需要在我的网站上做一些更改,所以我将整个网站下载到我的电脑,更改了IP和登录详细信息,网站正在运行。

但是,当我去一个页面时,我按下按钮,没有任何反应,同样的按钮在webhost上工作。

这是我正在使用的代码(在正在运行的webhost上完全相同):

if($serverSettings['itemshop']) {
    if(isset($_GET['p']) && checkInt($_GET['p'])) {
      $sqlCmdS="SELECT * FROM ".SQL_HP_DB.".is_items WHERE kategorie_id='".$_GET['p']."' AND anzeigen='J' ORDER BY preis ASC, vnum ASC";
    }
    else {
      $sqlCmdS="SELECT * FROM ".SQL_HP_DB.".is_items WHERE anzeigen='J' ORDER BY preis DESC, vnum DESC";
    }

  ?>
  <div id="isleft">
    <h2>Categorías</h2><br/>
    <ul>
      <?PHP
        $sqlCmd = "SELECT * FROM ".SQL_HP_DB.".is_kategorien WHERE anzeigen='J' ORDER BY id ASC;";
        $sqlQry = mysql_query($sqlCmd,$sqlHp);
        while($getKats = mysql_fetch_object($sqlQry)) {
          echo'<li><a href="./itemshop-'.$getKats->id.'.htm">'.$getKats->titel.'</a></li>';
        }
      ?>
    </ul>
  </div>
  <div id="isright">
<table>
    <?PHP
      $sqlQry = mysql_query($sqlCmdS,$sqlHp);
      $counter = 1;
      while ($getItems = mysql_fetch_object($sqlQry)) {
        $aktItem = compareItems($getItems->vnum);
        $aktItem1 = compareItems($getItems->id);
        $nome = compareItems($getItems->nome);
        $itemStufe = (checkInt($aktItem['stufe'])) ? "+".$aktItem['stufe'] : '';

        //$itemStufe1 = (checkInt($aktItem1['stufe'])) ? "+".$aktItem1['stufe'] : '';
        ?>
        <tr>
          <th colspan="2" class="topLine"><?= $nome['item'] ?> (<b><?= $getItems->count ?>x</b>) (<b><?= $getItems->preis ?> Coins</b>)</th>
        </tr>
        <tr>
          <td class="isImg">
            <?PHP
              if(!empty($getItems->bild)) echo'<img src="./is_img/'.$getItems->bild.'.png" title="'.$aktItem['item'].'" alt="'.$aktItem['item'].'"/>';
            ?>
          </td>
          <td class="tdunkel"><?= $getItems->beschreibung ?></td>
        </tr>
        <tr>
          <td colspan="2" class="isBuy">
            <select id ="escolha<? echo $counter ?>">
            <option value="">Escolhe...</option>
            <option value="eu">Para mim</option>
            <option value="outro">Para outro jogador</option>
            </select><button onclick="confirmacao(escolha<? echo $counter; ?>,<? echo $getItems->id ?>,<? echo $getItems->preis; ?>)" title="Vais gastar <? echo $getItems->preis; ?> moedas">Comprar</button>
          </td>
        </tr>


        <?PHP
        $counter++;
      }
    ?>
      </table>
  </div>
<script>
function confirmacao(escolha,id,preco)
{
    //var val = escolhida.options[escolhida.selectedIndex].value;

    switch(escolha.options[escolha.selectedIndex].value)
    {
        case "eu":
            function confirma_compra(id,preco)
            {
                var ask = window.confirm("Queres mesmo comprar?\nIrão ser removidas "+preco+" moedas da tua conta!");

                if (ask)
                {
                    document.location.href = './is_buy-'+id+'.htm';

                }
            }

            return confirma_compra(id,preco)

            break;

        case "outro":
                document.location.href = './is_buy_outro-'+id+'.htm';
            break;

        case "":
            alert("Tens de selecionar uma opção!");

            break;

        default:
            alert("test");

    }

    return false;
}
</script>

而且,这发生在按钮的工具提示上:https://prnt.sc/ff9mka

提前致谢

1 个答案:

答案 0 :(得分:0)

正如我在屏幕截图中看到的那样,他们会向您显示“<? echo ... ?>

问题是哪些新版本的PHP已弃用短标签。您需要使用完整的代码更改所有代码<?<?php