我想使我的網站使用更多的PHP爲了節省HTML代碼的空間,我想嘗試使用此代碼來創建一個菜單,將啓動不同的div
s包含不同的頁面或信息本身,我想知道如果搜索機器人由於php或Javascript或兩者都難以導航這樣的迷宮?搜索機器人會在onclick事件中尋找/索引PHP代碼中的鏈接時遇到問題嗎?
下面的代碼,
<?php
if($_GET['button1']){fun1();}
if($_GET['button2']){fun2();}
function fun1()
{
//creates a div with a link to google
echo'<a href = "http://www.google.com"><div style = "height:100px; width:20px; top:100px; left:100px; background-color: black;"></div></a>';
}
function fun2()
{
//creates a div with a link to yahoo
echo'<a href = "http://www.yahoo.com"><div style = "height:200px; width:40px; top:200px; left:200px; background-color: red;"></div></a>';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
</head>
<body>
<button id="btnfun1" name="btnfun1" onClick='location.href="?button1=1"'>Update to 1</button>
<button id="btnfun2" name="btnfun2" onClick='location.href="?button2=1"'>Update to 2</button>
</body>
</html>
不要指望它:)。常規鏈接有什麼問題? – kapa
鏈接在文本中 - 我認爲將它拉出是沒有問題的。它可能不瞭解確切的_relationship_(「鏈接到x的按鈕上的內容」),但這不是真正的搜索引擎如何工作。然而。 – Floris
@kapa,沒什麼,我沒有解釋爲什麼我要這個,雖然,使用PHP更新div的單個頁面。 – pandoragami