我创建了一个对话,现在,我怎么关闭它? [英] I Created A Dialog, Now How Can I Close It?
问题描述
我已经包含下面的头部部分的链接到我的网站进行审查的JS,以及为让你看到我是如何设置这一切了。如果你不想使用的链接,我也会尝试包括以下code。
我最近才知道我的网站的一些基本的AJAX和选择页面<一href="http://classifieds.your-adrenaline-fix.com/detail.php?fatherID=37&TypeID=42&ListingID=42" rel="nofollow">http://classifieds.your-adrenaline-fix.com/detail.php?fatherID=37&TypeID=42&ListingID=42我创建了一个对话框,你会看到出现onscroll。
如果有人可以请跟我分享一下我怎么能做出的关闭按钮关闭对话框,我会最AP preciative。
这里的JS
&LT;脚本类型=文/ JavaScript的&GT;
功能loaddiv(thediv,thefile){
如果(window.XMLHtt prequest){
XMLHTTP =新XMLHtt prequest();
} 其他 {
XMLHTTP =新的ActiveXObject(Microsoft.XMLHTTP);
}
xmlhttp.onreadystatechange =功能(){
如果(xmlhttp.readyState == 4和&安培; xmlhttp.status == 200){
的document.getElementById(thediv).innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open(GET,thefile,真正的);
xmlhttp.send();
}
&LT; / SCRIPT&GT;
然后在页面上我只有
回声&LT; DIV ID ='DIV2'&GT;&LT; / DIV&gt;中;
那么对于弹出的对话框:
&LT; DIV CLASS =DoYouHaveADirtBikeForSaleBox&GT;
&LT; H2&GT;有一个越野车你想卖&LT;?/ H2&GT;
&其中,P类=DirtBikeForSaleBannerButton&GT;
&LT; A HREF =http://classifieds.your-adrenaline-fix.com/add.php&GT;是啊,告诉我如何与LT; / A&GT;
&所述; / P&GT;
&其中,P类=DirtBikeForSaleBannerButtonNoThanks&GT;
&LT; A HREF =CloseDialog&GT;不,获得这出路&LT的; / A&GT;
&所述; / P&GT;
&LT; / DIV&GT;
如果任何人都可以与我分享我怎么可以与关闭按钮的点击我会最AP preciative,我想谢谢大家提前该对话框中消失。
谢谢
司徒氏/ P>
或者你可以尝试这样的:
&LT; DIV CLASS =DoYouHaveADirtBikeForSaleBoxID =DoYouHaveADirtBikeForSaleBox&GT;
&LT; H2&GT;有一个越野车你想卖&LT;?/ H2&GT;
&其中,P类=DirtBikeForSaleBannerButton&GT;
&LT; A HREF =http://classifieds.your-adrenaline-fix.com/add.php&GT;是啊,告诉我如何与LT; / A&GT;
&所述; / P&GT;
&其中,P类=DirtBikeForSaleBannerButtonNoThanks&GT;
&LT;一onclick="javascript:document.getElementById('DoYouHaveADirtBikeForSaleBox').style.visibility='hidden';">Nope,得到这个出路&LT的; / A&GT;
&所述; / P&GT;
&LT; / DIV&GT;
测试在我的本地的xD
___________EDITED_______________
最好尝试,看看是否滚动犯规再次显示DIV:
&LT; DIV CLASS =DoYouHaveADirtBikeForSaleBoxID =DoYouHaveADirtBikeForSaleBox&GT;
&LT; H2&GT;有一个越野车你想卖&LT;?/ H2&GT;
&其中,P类=DirtBikeForSaleBannerButton&GT;
&LT; A HREF =http://classifieds.your-adrenaline-fix.com/add.php&GT;是啊,告诉我如何与LT; / A&GT;
&所述; / P&GT;
&其中,P类=DirtBikeForSaleBannerButtonNoThanks&GT;
&LT;一的onclick =JavaScript的:VAR股利=的document.getElementById('DoYouHaveADirtBikeForSaleBox'); div.parentNode.removeChild(DIV);&GT;不,获得这出路&LT的; / A&GT;
---------------------------- UPDATE2 ------------------ ---------------
&LT; DIV ID ='DIV2'&GT;
&LT; DIV CLASS =DoYouHaveADirtBikeForSaleBoxID =DoYouHaveADirtBikeForSaleBox&GT;
&LT; H2&GT;有一个越野车你想卖&LT;?/ H2&GT;
&其中,P类=DirtBikeForSaleBannerButton&GT;
&LT; A HREF =http://classifieds.your-adrenaline-fix.com/add.php&GT;是啊,告诉我如何与LT; / A&GT;
&所述; / P&GT;
&其中,P类=DirtBikeForSaleBannerButtonNoThanks&GT;
&LT;一的onclick =JavaScript的:VAR股利=的document.getElementById('DIV2'); div.parentNode.removeChild(DIV);&GT;不,获得这出路&LT的; / A&GT;
&所述; / P&GT;
&LT; / DIV&GT;
&LT; / DIV&GT;
Saludos;)
I have included a link to my site below for review of the JS in the head section, as well as to allow YOU to see how I set it all up. If you don't want to use the link, I'll also try to include the code below.
I recently learned some basic AJAX and on select pages of my site http://classifieds.your-adrenaline-fix.com/detail.php?fatherID=37&TypeID=42&ListingID=42 I have created a dialog that you'll see appear onscroll.
If someone could please share with me how I can make the close button close the dialog box I'd be most appreciative.
Here's the JS
<script type="text/javascript">
function loaddiv(thediv, thefile) {
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject ('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById(thediv).innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open('GET', thefile, true);
xmlhttp.send();
}
</script>
Then on the page I only have
echo "<div id='div2'></div>";
Then for the box that pops up:
<div class="DoYouHaveADirtBikeForSaleBox">
<h2>Got A Dirt Bike You Want to Sell?</h2>
<p class="DirtBikeForSaleBannerButton">
<a href="http://classifieds.your-adrenaline-fix.com/add.php">Yea, Show Me How</a>
</p>
<p class="DirtBikeForSaleBannerButtonNoThanks">
<a href="CloseDialog">Nope, Get This Out of The Way</a>
</p>
</div>
If anyone could share with me how I can make this dialog box disappear with a click of the close button I'd be most appreciative and I'd like to thank you all in advance.
Thanks,
Stuart K
Or you can try this:
<div class="DoYouHaveADirtBikeForSaleBox" id="DoYouHaveADirtBikeForSaleBox">
<h2>Got A Dirt Bike You Want to Sell?</h2>
<p class="DirtBikeForSaleBannerButton">
<a href="http://classifieds.your-adrenaline-fix.com/add.php">Yea, Show Me How</a>
</p>
<p class="DirtBikeForSaleBannerButtonNoThanks">
<a onclick="javascript:document.getElementById('DoYouHaveADirtBikeForSaleBox').style.visibility='hidden';">Nope, Get This Out of The Way</a>
</p>
</div>
Tested on my localhost xD
___________EDITED_______________
Better try this and see if the scroll doesnt show the div again:
<div class="DoYouHaveADirtBikeForSaleBox" id="DoYouHaveADirtBikeForSaleBox">
<h2>Got A Dirt Bike You Want to Sell?</h2>
<p class="DirtBikeForSaleBannerButton">
<a href="http://classifieds.your-adrenaline-fix.com/add.php">Yea, Show Me How</a>
</p>
<p class="DirtBikeForSaleBannerButtonNoThanks">
<a onclick="javascript:var div = document.getElementById('DoYouHaveADirtBikeForSaleBox');div.parentNode.removeChild(div);">Nope, Get This Out of The Way</a>
----------------------------UPDATE2---------------------------------
<div id='div2'>
<div class="DoYouHaveADirtBikeForSaleBox" id="DoYouHaveADirtBikeForSaleBox">
<h2>Got A Dirt Bike You Want to Sell?</h2>
<p class="DirtBikeForSaleBannerButton">
<a href="http://classifieds.your-adrenaline-fix.com/add.php">Yea, Show Me How</a>
</p>
<p class="DirtBikeForSaleBannerButtonNoThanks">
<a onclick="javascript:var div = document.getElementById('div2');div.parentNode.removeChild(div);">Nope, Get This Out of The Way</a>
</p>
</div>
</div>
Saludos ;)
这篇关于我创建了一个对话,现在,我怎么关闭它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!