Results 1 to 3 of 3

Thread: Interstitial Script Activated by button or link?

  1. #1
    Join Date
    Dec 2012
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Interstitial Script Activated by button or link?

    Interstitial Content Box
    http://www.dynamicdrive.com/dynamici...terstitial.htm

    Is there a way for the interstitial script to only be activated by the user via a button or link?

    Thx!
    Last edited by homersheineken; 12-21-2012 at 05:19 PM. Reason: following protocol

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format when asking a question.
    DD Admin

  3. The Following User Says Thank You to ddadmin For This Useful Post:

    homersheineken (12-21-2012)

  4. #3
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style type="text/css">
    /*<![CDATA[*/
    .popup{
      position: absolute;visibility:hidden;padding: 15px;padding-top: 0;background-color: #d0e47e;border: 1px solid black;z-index: 6;
      width: 670px; /*Width of popup*/
    }
    
    .popup .headerbar{ /*CSS for header bar of popup*/
      position:relative;color: gray;padding: 5px 0;height:30px;text-align:left;font-size: 20px;
    }
    
    
    .popup .headerbar IMG { /*CSS for header bar image of popup*/
      position:absolute;left:650px;top:5px;
    }
    
    .content { /*CSS for div that holds the content to show*/
      border: 1px solid gray;background-color: white;
    }
    
    .mask{ /*CSS for background mask*/
     position:fixed;background-Color: black;width:100%;height:100%;left:0px;top:0px;z-index: 5;filter:progid:DXImageTransform.Microsoft.alpha(opacity=80);opacity: 0.8;
    }
    
    /*]]>*/
    </style>
    </head>
    
    <body>
     for pop1<br />
     <input type="button" name="" value="Display pop 2" onmouseup="zxcSplashPopUp.Display('pop1');"/>
     <input type="button" name="" value="Ajax File 1" onmouseup="zxcSplashPopUp.Ajax('pop1','http://www.dynamicdrive.com/dynamicindex17/samplecontent.htm');"/>
     <input type="button" name="" value="Ajax File 2" onmouseup="zxcSplashPopUp.Ajax('pop1','http://www.dynamicdrive.com/dynamicindex17/samplecontent2.htm');"/>
     <input type="button" name="" value="HTML" onmouseup="zxcSplashPopUp.HTML('pop1','http://www.dynamicdrive.com/dynamicindex17/samplecontent2.htm');"/>
     <br />
     <br />
     for pop 2<br />
     <input type="button" name="" value="Display pop 2" onmouseup="zxcSplashPopUp.Display('pop2');"/>
     <input type="button" name="" value="Ajax File 1" onmouseup="zxcSplashPopUp.Ajax('pop2','http://www.dynamicdrive.com/dynamicindex17/samplecontent.htm');"/>
     <input type="button" name="" value="Ajax File 2" onmouseup="zxcSplashPopUp.Ajax('pop2','http://www.dynamicdrive.com/dynamicindex17/samplecontent2.htm');"/>
     <input type="button" name="" value="HTML" onmouseup="zxcSplashPopUp.HTML('pop2','http://www.dynamicdrive.com/dynamicindex17/samplecontent2.htm');"/>
    
     <div id="pop1" class="popup" >
      <div class="headerbar" >
       pop 1 <img src="http://www.vicsjavascripts.org.uk/StdImages/Exit1.gif" style="border: 0" title="Close Box" onmouseup="zxcSplashPopUp.Hide('pop1');" />
      </div>
     </div>
    
     <div id="pop2" class="popup" style="background-Color:#FFFFCC;" >
      <div class="headerbar">
       pop 2 <img src="http://www.vicsjavascripts.org.uk/StdImages/Exit1.gif" style="border: 0" title="Close Box" onmouseup="zxcSplashPopUp.Hide('pop1');" />
      </div>
      <div id="content2" class="content" >
       some text<br />
       some text<br />
      </div>
     </div>
    <script> vic=0; </script>
    <form name=Show id=Show style="position:absolute;visibility:visible;top:700px;left:0px;" >
    <input size=100 name=Show0 >
    <input size=10 name=Show1 >
    <input size=10 name=Show2 >
    <input size=10 name=Show3 >
    <input size=10 name=Show4 >
    <input size=10 name=Show5 >
    <input size=10 name=Show6 >
    <input size=10 name=Show7 >
    <input size=10 name=Show8 >
    <input size=10 name=Show9 ><br>
    <textarea name=TA rows=1 cols=100 ></textarea>
    </form>
    
    <script type="text/javascript">
    /*<![CDATA[*/
    // SplashPopUp. (22-December-2012)
    // by Vic Phillips - http://www.vicsjavascripts.org.uk/
    
    var zxcSplashPopUp={
    
     init:function(o){
      var id=o.ID,ccls=o.ContentClass,mcls=o.MaskClass,ajax=o.AjaxFile,f=o.DisplayFrequency,ms=o.AnimateDuration,days=o.DaysPersistence,pop=document.getElementById(id),div=document.createElement('DIV'),msk=div.cloneNode(false),ccls=typeof(ccls)=='string'?ccls:false,days=typeof(days)=='string'?days:-1,nu;
      if (ccls){
       div.className=ccls;
       pop.appendChild(div);
      }
      pop.style.overflow='hidden';
      msk.className=mcls;
      msk.style.position='fixed';
      msk.style.visibility='hidden';
      msk.style.left='0px';
      msk.style.top='0px';
      msk.style.width='100%';
      msk.style.height='100%';
      msk.appendChild(pop);
      document.body.appendChild(msk);
      o=zxcSplashPopUp['zxc'+id]={
       id:id,
       msk:msk,
       pop:pop,
       div:ccls?div:document.getElementById(o.ContentID),
       ms:typeof(ms)=='number'&&ms>0?ms:false,
       days:days
      }
      f=typeof(f)=='number'&&(Math.round(Math.random()*f)==0||this.cookie(id+'=')=='true');
      if (o.div&&typeof(ajax)=='object'&&ajax.constructor==Array){
       nu=Math.floor(Math.random()*ajax.length);
       if (typeof(ajax[nu])=='string'){
        o.ajax=ajax[nu];
        this.ajax(o,o.ajax,f);
       }
      }
      if (!o.ajax&&f){
       this.ready(o);
      }
      this.pop=o;
      this.addevt(msk,'mousedown','Hide',id);
     },
    
     Hide:function(id,e){
      var o=zxcSplashPopUp['zxc'+id],obj;
      if (o){
       if (e){
        obj=e.target?e.target:e.srcElement;
        while (obj.parentNode){
         if (obj==o.pop){
          return;
         }
         obj=obj.parentNode;
        }
       }
       if (o.ms){
        clearTimeout(o.dly);
        this.animate(o,'height',o.pop.offsetHeight,0,new Date(),o.ms);
       }
       else {
        this.hide(o);
       }
       this.cookieset(o,false);
      }
     },
    
     Ajax:function(id,url){
      var o=zxcSplashPopUp['zxc'+id];
      if (o&&o.div&&typeof(url)=='string'){
       if (o.ajax&&o.ajax.substring(url.lastIndexOf('/')+1)==url.substring(url.lastIndexOf('/')+1)){
        this.ready(o);
       }
       else {
        o.ajax=url;
        this.ajax(o,url);
       }
      }
     },
    
     HTML:function(id,html){
      var o=zxcSplashPopUp['zxc'+id];
      if (o&&o.div&&typeof(html)=='string'){
       o.ajax='';
       o.div.innerHTML=html;
       this.ready(o);
      }
     },
    
     Display:function(id){
      var o=zxcSplashPopUp['zxc'+id];
      if (o){
       this.ready(o);
      }
     },
    
     ready:function(o){
      if (o!=this.pop){
       this.hide(this.pop);
      }
      o.pop.style.left=(o.msk.offsetWidth-o.pop.offsetWidth)/2+'px';
      o.pop.style.top=(o.msk.offsetHeight-o.pop.offsetHeight)/2+'px';
      this.pop=o;
      if (o.ms){
       clearTimeout(o.dly);
       this.animate(o,'height',0,o.pop.offsetHeight,new Date(),o.ms);
      }
      o.msk.style.visibility=o.pop.style.visibility='visible';
      this.cookieset(o,true);
     },
    
     animate:function(o,mde,f,t,srt,mS){
      var oop=this,ms=new Date().getTime()-srt,now=(t-f)/mS*ms+f;
      if (isFinite(now)){
       o.pop.style[mde]=Math.max(now,0)+'px';
      }
      if (ms<mS){
       o.dly=setTimeout(function(){ oop.animate(o,mde,f,t,srt,mS); },10);
      }
      else {
       o.pop.style[mde]=t+'px';
       if (t==0&&mde=='height'){
        this.hide(o);
       }
      }
     },
    
     hide:function(o){
      clearTimeout(o.dly);
      o.msk.style.visibility=o.pop.style.visibility='hidden';
      o.pop.style.height='auto';
     },
    
     addevt:function(o,t,f,p){
      var oop=this;
      if (o.addEventListener){
       o.addEventListener(t,function(e){ return oop[f](p,e);}, false);
      }
      else if (o.attachEvent){
       o.attachEvent('on'+t,function(e){ return oop[f](p,e); });
      }
     },
    
     cookie:function(nme){
      var re=new RegExp(nme+'[^;]+','i');
      if (document.cookie.match(re)){
       return document.cookie.match(re)[0].split("=")[1];
      }
      return null
     },
    
     cookieset:function(o,ud){
      document.cookie=o.id+'='+ud+';expires='+(new Date(new Date().getTime()+o.days*86400000).toGMTString())+';path=/';
     },
    
     ajax:function(o,url,f){
      var oop=this,html=false;
      if (window.ActiveXObject){
       try {
        html=new ActiveXObject("Msxml2.XMLHTTP");
       }
       catch (e){
        try {
         html=new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e){
        }
       }
      }
      else if (window.XMLHttpRequest){
       html=new XMLHttpRequest();
      }
      else {
       return false;
      }
      html.onreadystatechange=function(){ oop.ajaxpopulate(o,html,f); }
      html.open('GET',url+'?'+new Date().getTime(),true);
      try {
       html.send(null);
      }
      catch (e){
      }
     },
    
     ajaxpopulate:function(o,html,f){
      if (html.readyState==4&&(html.status==200||window.location.href.indexOf("http")==-1)){
       html=html.responseText;
       if (o&&html){
        o.div.innerHTML=html;
        if (f){
         this.ready(o);
        }
       }
      }
     }
    
    }
    
    zxcSplashPopUp.init({
     ID:'pop1',              // the unique ID name of the Pop Up DIV.                                  (string)
     ContentClass:'content', //(optional) the class name of the Pop Up content DIV.                    (string, default = ContentID or the PopUp DIV HTML)
     ContentID:null,         //(optional) the unique ID name of the Pop Up content DIV.                (string, default = ContentClass or the PopUp DIV HTML)
     MaskClass:'mask',       //(optional) the class name of the Pop Up mask DIV.                       (string, default = no mask)
     DisplayFrequency:1,     //(optional) the display on initialisation frequency, 0 = always.         (number, default = no display on initialisation)
     AjaxFile:[              //(optional) display a ajax random file from the array on initialisation. (array, default = the PopUp DIV HTML)
      'http://www.dynamicdrive.com/dynamicindex17/samplecontent.htm','http://www.dynamicdrive.com/dynamicindex17/samplecontent2.htm'
     ],
     AnimateDuration:1000,   //(optional) the animation speed in milli seconds.                        (number, default = no  animation)
     DaysPersistence:-1      //(optional) number = the number of days to restore the pop up.           (number, default = -1 = no persistence)
    });
    
    zxcSplashPopUp.init({
     ID:'pop2',              // the unique ID name of the Pop Up DIV.                        (string)
     ContentID:'content2',   // the unique ID name of the Pop Up content DIV.                (string)
     AnimateDuration:1000    // the animation speed in milli seconds.                        (number, default = no  animation)
    });
    
    /*]]>*/
    </script>
    
    </body>
    
    </html>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  5. The Following User Says Thank You to vwphillips For This Useful Post:

    homersheineken (01-02-2013)

Similar Threads

  1. Script Title: Interstitial Content Box (v1.1)
    By shakti007 in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 02-09-2012, 04:24 PM
  2. Slideshow activated onMouseOver
    By snooper in forum Looking for such a script or service
    Replies: 0
    Last Post: 06-10-2009, 10:19 PM
  3. open Interstitial Content Box with a link?
    By badbandit in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 10-13-2007, 10:45 AM
  4. script activated from drop down box
    By martyn1987 in forum JavaScript
    Replies: 15
    Last Post: 07-18-2007, 02:01 PM
  5. Modify Interstitial Box script
    By terkini in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 12-18-2006, 08:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •