我可以使用以下方法使 div 在同一页面上不可见:
document.getElementById("txtHint").style.display = "none";
我的主页是index.php
. 当用户单击按钮时,它使用 ajax 调用加载 tge 页面 url.php
,并且 url.php 的内容出现在同一页面 index.php 中
现在url.php
我有<div>
它应该在按钮单击后出现。
在 index.php 上
<body onload="show1()">
和 show1() 是
function show1(){
//alert("hi");
document.getElementById("txtHint").style.display = "none";
document.getElementById("d1").style.display = "none";
}
url.php 页面上的按钮
<input type="submit" onclick="show2();" value="view div" > View Div </input>
和 show() 是
function show2(){
//alert("hi");
document.getElementById("txtHint").style.display = "block";
document.getElementById("d1").style.display = "block";
}
我还尝试在 url.php 上保留 show1 和 show2 但没有变化。div 无论如何都不会变得不可见。