The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Easy question?, least amount of code for popup
linksavage
post May 5 2009, 07:03 PM
Post #1





Group: Members
Posts: 1
Joined: 5-May 09
Member No.: 8,525



hello, plz be easy on me as i am brand new to the forum!

i need the absolute minimum amount of html code (i.e. number of characters of code < or = 150) necessary to create a popup window of a specific size, using absolute links.

What I have so far seems to open the directory on the server where the image is, but i need it to open with the image showing in the popup:

<a href="http://company.com/r.gif" target="1" onclick="window.open('http://company.com/r.gif', '1', 'width=730,height=806'); return false">Pop</a>

Can you help? Thanks!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post May 6 2009, 12:16 AM
Post #2


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 18,366
Joined: 9-August 06
Member No.: 6



AFAICS it should do that already. Please post the link to the page in question. Maybe something is different in the real code.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post May 6 2009, 04:28 AM
Post #3


.
********

Group: WDG Moderators
Posts: 8,216
Joined: 10-August 06
Member No.: 7



I see nothing wrong with the example code either.

QUOTE(linksavage @ May 6 2009, 02:03 AM) *

i need the absolute minimum amount of html code (i.e. number of characters of code < or = 150) necessary to create a popup window of a specific size

You can create both the popup and the onclick event that opens it with javascript :

CODE

<a href="foo.html" class="popup">Foo</a>

<script type="text/javascript">
var a=document.getElementsByTagName('a');
for(var i=0; i<a.length; i++)
{    
    if(a[i].className=='popup' && window.open)
    {
        a[i].onclick=function()
        {
            window.open(this.href, '_blank', 'width=800, height=500, resizable=yes, scrollbars=yes, location=no, toolbar=no, menubar=no');
            return false;
        }        
    }
}
</script>

The above only creates popups from links with the CLASS "popup", otherwise all links would be affected. The script can be put in an external .js file, but the SCRIPT element should appear after the last link on each page.

QUOTE
using absolute links

What's that, links with absolute URLs? That shouldn't matter.

Keep in mind that browsers may use popup blockers that both stops the popup from opening and the original HTML links from working, so you may want to display a notice about that.

This post has been edited by Christian J: May 6 2009, 05:13 AM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 15th September 2019 - 12:37 AM