weixin_33695082 2013-03-20 18:56 采纳率: 0%
浏览 28


This question already has answers here:
                    <div class="grid--cell mb0 mt4">
                        <a href="/questions/15527866/i-created-a-dialog-now-how-can-i-close-it" dir="ltr">I Created A Dialog, Now How Can I Close It?</a>
                            <span class="question-originals-answer-count">
                                (5 answers)
            <div class="grid--cell mb0 mt8">Closed <span title="2013-03-22 00:26:11Z" class="relativetime">7 years ago</span>.</div>

This is a 2nd thread of a first I started here: I Created A Dialog, Now How Can I Close It?

I'm creating a new thread so I can include updated code.

First of all I'd like to give an enormous THANKS to all whom have helped me in the post linked above but as I stated, I'm starting this thread so I can add code samples.

I have a dialog on some of my pages that appears onscroll but I'm having some trouble.

This dialog can be seen here: (The semi transparent box that appears) http://classifieds.your-adrenaline-fix.com/detail.php?fatherID=37&TypeID=42&ListingID=42

On detail.php I have:
(in the head)

    <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);

Below That:

    <body onscroll="loaddiv('div2', 'do-you-have-a-dirt-bike-for-sale.html')">


    if (!Has_Seen_DB_For_Sale_Dialog($user_ip)){
        echo "<div id='div2'></div>";

Above that (in an include file) I have:

    function Has_Seen_DB_For_Sale_Dialog($ip){
        global $user_ip;
        $query ="SELECT `IP` FROM `DB_For_Sale_Dialog` WHERE `IP`='$user_ip'";
        $query_run = mysql_query($query);

        $query_num_rows = mysql_num_rows($query_run);
            return false;
            }   else if($query_num_rows==1){
            return true;

    function ip_add($ip){
        $query = "INSERT INTO `DB_For_Sale_Dialog` VALUES('', '$ip') ";
        @$query_run = mysql_query($query);

And the file that is displayed looks like:

<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 class="DirtBikeForSaleBannerButtonNoThanks">
    <a onclick="javascript:var div = document.getElementById('div2');div.parentNode.removeChild(div);">Nope, Get This Out of The Way</a></p> 

I'm VERY Grateful of the help provided me in my last thread and mean NO disrespect in starting a new thread but What I'm now having trouble with is:

When I hover over the right button to close the box, the pointer doesn't turn into a hand as it does with other links.

When the dialog box is closed and the page is scrolled, the box reappears. (the function to display the box is called onscroll but I only want the box to appear ONCE.

If anyone wouldn't mind commenting on this I'd be most appreciative and I certainly look forward to your responses.

Thanks So Much, Stuart K

  • 写回答




      • ¥15 GEO下载数据的处理报错 :函数‘Meta’标签‘"data.frame"’找不到继承方法,如何解决?
      • ¥15 DLNM模型是否可以用二分类变量作为y变量
      • ¥15 android object box 一个实体多个表怎么写
      • ¥15 temux 启用docker 服务失败
      • ¥15 Flask 使用celery发送邮件出现‘目标计算机积极拒绝‘
      • ¥60 老人用的sd卡在手机里面不知道操作了什么,导致图片和视频变成了文件,取下sd卡连接电脑就是图中的样子,后缀改为.jpg才可以,需要用系统的画图软件才能打开,文件属性还是文件,有没有批量操作的解决办法
      • ¥15 超时跳出方法代码的返回值问题
      • ¥15 汇编语言程序设计设计,ascii码求数,再求数的BCD码
      • ¥30 Mask rcnn训练自己的数据集出现问题!
      • ¥20 研究人工智能时的几个问题