5,542,300 members and growing! (17,677 online)
Email Password   helpLost your password?
Web Development » Client side scripting » General     Intermediate

A Javascript Scrolling Popup

By Massimo Beatini

With this script you can build scrolling popups for your web pages choosing display corner and scrolling direction.
Javascript, Windows, Visual Studio, Dev

Posted: 14 Feb 2006
Updated: 14 Feb 2006
Views: 34,098
Bookmarked: 21 times
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
10 votes for this Article.
Popularity: 3.57 Rating: 3.57 out of 5
1 vote, 10.0%
1
1 vote, 10.0%
2
1 vote, 10.0%
3
1 vote, 10.0%
4
6 votes, 60.0%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article

Sample Image - js_scrolling_popup.gif

Introduction

This script allow you to build a scrolling pop up using divs. You can locate the scrolling pop up in a corner of a web page and choose the scrolling direction (i.e. left-to-right or top-down) This script has been tested only with Internet Explorer 6.0, Firefox 1.0.7 and Opera 8.51 on Windows 2003 Server.

How it works

The script builds the pop up structure using 2 divs and you can decide to put directly an html code inside the pop up using the function buildPopup_HtmlCode
//

//  buildPopup_HtmlCode

//  build popup passing it the html code to put inside

//

function buildPopup_HtmlCode(width, height, title, htmlCode)
{
    if (width)
        popupWidth = width;
       
    if (height)
        popupHeight = height;

    if (title)
        _title = title

    document.write('<div id="postit" class="postit">');

    document.write('<div id="postit_title" class="title"><b>' + _title + 
'<span class="spantitle"><img src="close.gif" border="0" ' +
 'title="Close" align="right" WIDTH="11" HEIGHT="11" onclick="closeit()"> </b></span></div>');
    document.write('<div id="postit_content" class="content">'); 

    document.write(htmlCode);                

    document.write('</div></div>');

    getCrossObj();
}
or specify a the url of a frame to show inside using the function buildPopup_Frame
//

//  buildPopup_Frame

//  passing it the url of the frame to display inside

//

function buildPopup_Frame(width, height, title, framesrc)
{
    if (width)
        popupWidth = width;
       
    if (height)
        popupHeight = height;
        
    if (title)
        _title = title
    

    document.write('<div id="postit" class="postit" >');

    document.write('<div id="postit_title" class="title"><b>' + _title + ' <span class="spantitle"><img src="close.gif" border="0" ' +
'title="Close" align="right" WIDTH="11" HEIGHT="11" onclick="closeit()"> </b></span></div>');
    document.write('<div id="postit_content" class="content">'); 

    document.write('<iframe src="' + framesrc + '" width="100%" height="100%" marginwidth="0" marginheight="0" ' +
'hspace="0" vspace="0" frameborder="0" scrolling="no" bordercolor="#000000"></iframe>');

    document.write('</div></div>');
    
    getCrossObj();
}
The building function also accepts width, height and title parameters to characterize your pop up.

How to use it

The pop up's layout is customizable using the scrolling_popup.css file.
To use the script first you must insert the following html code in the head section of your page:
    
Then you have to call one of the two building functions
    
		
Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 6 of 6 (Total in Forum: 6) (Refresh)FirstPrevNext
Subject  Author Date 
Generalcall the both function in button clickmembersridhar214:47 3 Sep '07  
Questionshow with Linkmemberurgido12:21 19 Jul '06  
AnswerRe: show with LinkmemberMassimo Beatini22:13 19 Jul '06  
QuestionRe: show with Linkmemberurgido20:34 25 Jul '06  
AnswerRe: show with Linkmemberurgido20:35 25 Jul '06  
AnswerRe: show with LinkmemberMassimo Beatini23:00 25 Jul '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 14 Feb 2006
Editor:
Copyright 2006 by Massimo Beatini
Everything else Copyright © CodeProject, 1999-2008
Web11 | Advertise on the Code Project