2011-09-07 33 views
0

由於某些非常困難的原因,我在插入附加內容之前,在我的頁面開始之前,在我的真實<head>開始之前。這來自另一個應用程序,我不能刪除它。如何刪除頁面上的其他html對象

因此,代碼如下所示:

<html><head><title>Object moved</title></head><body> 
<h2>Object moved to <a href="http://www.facebook.com/#!/nagradnaigra123.si?sk=app_163054567105477">here</a>.</h2> 
</body></html> 
<!DOCTYPE html 
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
... normal content from here on... 

所以即時問我如何在地球上可以在我的網頁begginig刪除附加頭。我可以編輯CSS,添加JavaScript,jQuery的,PHP ...但我只是不知道這個問題的解決方案。

這可能嗎?

+2

生成此頁面的代碼是什麼? – Piskvor

回答

0

將身體標籤從頭部取出。

應該

<head> 
stuff 
<title>Object moved</title> 
</head> 

<body> 
stuff 
<h2>Object moved to <a href="http://www.facebook.com/#!/nagradnaigra123.si?sk=app_163054567105477">here</a>.</h2> 

</body> 
0

通過把下面的代碼在你的<head>刪除第一個<title><h2>標籤。這將使額外的<html>標籤在開始時對您的頁面沒有任何影響。

<script type="text/javascript"> 
    var e = document.getElementsByTagName('title'); 
    e[0].parentNode.removeChild(e[0]); 
    e = document.getElementsByTagName('h2'); 
    e[0].parentNode.removeChild(e[0]); 
</script> 

適用於FireFox,未在其他瀏覽器中測試。

相關問題