我需要在 Confluence 上創建一個 google 搜索演示,以便代碼在 HTML 宏中。目前我的代碼是:
<div id="central"> <img src="https://www.google.com/images/srpr/logo5w.png" title="Google">
<form>
<input type="text" title="Search" value="For example, WordPress hosting">
<input type="submit" onclick="window.open('my url')" value="Google Search" />
<input type="submit" onclick="window.open('my url')" value="I'm feeling lucky" />
</form>
</div>
現在,如果用戶點擊 Google 搜索或者我感覺很幸運的“按鈕”,他們將被重定向到搜索結果或我需要的頁面。
是否可以通過單擊同一頁面打開另一個代碼?就像只有我需要的演示鏈接的虛假搜索結果一樣。對我來說,問題是代碼應該放在 Confluence 上的同一個 HTML 宏中,我不能創建其他檔案。
uj5u.com熱心網友回復:
你可以簡單地使用 javascript 切換
HTML
<div id="central"> <img src="https://www.google.com/images/srpr/logo5w.png" title="Google">
<form>
<input type="text" title="Search" value="For example, WordPress hosting">
<input type="button" onclick="myFunction()" value="Google Search" />
<input type="button" onclick="myFunction()" value="I'm feeling lucky" />
</form>
</div>
<div id="myDIV" style=" display: none;">
This is a DIV element.
</div>
CSS
.mystyle {
width: 100%;
padding: 25px;
background-color: coral;
color: white;
font-size: 25px;
}
JavaScript
function myFunction() {
var x = document.getElementById("myDIV");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/330683.html
下一篇:帶時間條件的HTML按鈕
