SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2001
    Location
    Kansas City, MO
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, here is what I want to do. I want to make it so when a word is clicked a small popup window comes up with a definition of the word. I know this can be done with javascript but how can I do it so that the window size depends on the lenth of the definition. I hope I explained myself good enough. Thanks, Andy

  2. #2
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think that sizing a window via the length of the content would be fairly difficult. The only thing I could think of would be to get the length of the string and x that by ave num of pixels per character and then take the square root rounded up and make that number the length and width.

    Complicated.
    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2001
    Location
    Kansas City, MO
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    do you know where I can find the javascript to do the popup window any way? I have looked on a lot of sites but am not sure what it is called so I can't find it. Thanks, Andy

  4. #4
    SitePoint Enthusiast
    Join Date
    Nov 2000
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Andwise,

    Take a look at the following:

    http://www.dynamicdrive.com/dynamicindex5/popinfo.htm

    http://www.dynamicdrive.com/dynamicindex5/popinfo2.htm

    Not sure if that's what your're looking for.

    Hope that helps
    brew

  5. #5
    SitePoint Zealot
    Join Date
    Feb 2001
    Location
    Kansas City, MO
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have considered something like that. Would it slow down the loading of my site and can you customize the colors? Thanks, Andy

  6. #6
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that script is fully customizeable with colors and a variety of other features.

    the actual script HP is http://www.bosrup.com/web/overlib/

    and it explains all the features there.
    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  7. #7
    SitePoint Enthusiast
    Join Date
    Nov 2000
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Andy,

    If you look at the template.html you'll see the following in the head section:

    <SCRIPT TYPE="" LANGUAGE="JavaScript">
    <!--
    var width = "250";
    var border = "3";
    var offsetx = 2;
    var offsety = 2;

    var fcolor = "#CCFFCC";
    var backcolor = "#339933";
    var textcolor = "#000000";
    var capcolor = "#FFFFFF";
    var closecolor = "#99FF99";

    // -->
    </SCRIPT>

    This is where you can change the colors. Regarding load time. I wouldn't think it would be noticeable.

    brew

  8. #8
    SitePoint Enthusiast sadhu's Avatar
    Join Date
    Nov 2000
    Location
    Vancouver, BC
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    *Put this in the Head, don't forget to add <script> tags
    <!--
    function NewWindow(mypage, myname, w, h, scroll) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable,menubar,status,location,toolbar'
    win = window.open(mypage, myname, winprops)
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
    }
    //-->

    *Put this around the link

    <A class=titleLink title="Opens in new window"
    onclick="NewWindow(this.href,'pd1','450','350','status=yes,toolbar=yes,location=yes,menubar=yes,scrollbars=yes,resizable=yes');return false;"
    href="http://www.somewhere.com">somewhere.com</A>

    You can configure wheather or not to keep the status bars, toolbars, menu, size it etc.
    Rustam Punja, WebMaster/Content Developer
    http://www.dvwt.net
    Bringing Online Education, Internet Access and Broadband to China


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
  •