Jump to content

[SOLVED] Pop up when click on image


Mr_J

Recommended Posts

Hi all,

I just have a small issue, I want to add a little info POP UP when the user click on the image. I have tried various methods incl. asp etc.

I have this nice "friend" texas web developers :) where I got the info from, but something is missing. 1st of all, it display the text on the main page instead of in the popup box and if I click the image(link) it brings the pop up to front but it show nothing

[code ]
<!-- POPUP Script -->
<script
        language='javascript'>
        <!--
        var twdPopupWindow=null;
        function twdPopup(mypage,myname,w,h,pos,infocus){
        if(pos=='random'){
        LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):200;
        TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):200;}
        if(pos=='center'){
        LeftPosition=(screen.width)?(screen.width-w)/2:200;
        TopPosition=(screen.height)?(screen.height-h)/2:200;}
        else if((pos!='center' && pos!='random') || pos==null){LeftPosition=200;TopPosition=200;}settings='width='+
        w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition +
        ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
        twdPopupWindow=window.open('',myname,settings);
        if(infocus=='front'){twdPopupWindow.focus();twdPopupWindow.location='timedclose.asp';}
        }
        //-->
        </script>
       
<!--POPUP Script END -->
[/code]

and the link of the image:

<a href="javascript:twdPopup('timedclose.asp','twdPopup','250','400','','front');">text text text<img src=images/question.png></a>

So I figured, I need timedclose.asp

I have more code for the timedclose.asp

<script language="JavaScript">
        var TWDWindowCloseTimed = 3;
        function SetupWindowClose()
        {
        window.setTimeout("window.close()",TWDWindowCloseTimed*1000);
        }
      var TWDSafeOnload = new Array();
        function TWDAddOnload(TWD)
        {
        isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
        IEmac = ((document.all)&&(isMac)) ? true : false;
        IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 
        4.")!=-1)) ? true : false;
        if (IEmac && IE4)
        {
        window.onload = SafeOnload;
        TWDSafeOnload[TWDSafeOnload.length] = TWD;
        }
        else if (window.onload)
        {
        if (window.onload != SafeOnload)
        {
        TWDSafeOnload[0] = window.onload;
        window.onload = SafeOnload;
        } 
        TWDSafeOnload[TWDSafeOnload.length] = TWD;
        }
        else
        window.onload = TWD;
        }
        function SafeOnload()
        {
        for (var i=0;i<TWDSafeOnload.length;i++)
        TWDSafeOnload[i]();
        }
        TWDAddOnload(SetupWindowClose);
        </script>

Please help...

 

 

Link to comment
Share on other sites

Fixed:

var twdPopupWindow=null;
        function twdPopup(mypage,myname,w,h,pos,infocus){
        if(pos=='random'){
        LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):200;
        TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):200;}
        if(pos=='center'){
        LeftPosition=(screen.width)?(screen.width-w)/2:200;
        TopPosition=(screen.height)?(screen.height-h)/2:200;}
        else if((pos!='center' && pos!='random') || pos===null){LeftPosition=200;TopPosition=200;}settings='width='+
        w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition +
        ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
        twdPopupWindow=window.open('',myname,settings);
        if(infocus=='front'){twdPopupWindow.focus();twdPopupWindow.location='timedclose.asp';}
        }

 

Continued:

var TWDWindowCloseTimed = 3;
        function SetupWindowClose()
        {
        window.setTimeout("window.close()",TWDWindowCloseTimed*1000);
        }
      var TWDSafeOnload = {};
        function TWDAddOnload(TWD)
        {
        isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
        IEmac = ((document.all)&&(isMac)) ? true : false;
        IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE4.")!=-1)) ? true : false;
        if (IEmac && IE4)
        {
        window.onload = SafeOnload;
        TWDSafeOnload[TWDSafeOnload.length] = TWD;
        }
        else if (window.onload)
        {
        if (window.onload != SafeOnload)
        {
        TWDSafeOnload[0] = window.onload;
        window.onload = SafeOnload;
        }
        TWDSafeOnload[TWDSafeOnload.length] = TWD;
        }
        else{
        window.onload = TWD;
}
        }
        function SafeOnload()
        {
	for (var i=0;i<TWDSafeOnload.length;i++){
	TWDSafeOnload[i]();
	}
        }
        TWDAddOnload(SetupWindowClose);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.