Click here to Skip to main content
6,596,602 members and growing! (19,488 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
Views:43,296
Bookmarked:26 times
Unedited contribution
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
12 votes for this article.
Popularity: 3.84 Rating: 3.56 out of 5
1 vote, 8.3%
1
2 votes, 16.7%
2
1 vote, 8.3%
3
1 vote, 8.3%
4
7 votes, 58.3%
5

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
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 7 of 7 (Total in Forum: 7) (Refresh)FirstPrevNext
GeneralMy vote of 2 Pinmemberakivam8:01 16 Feb '09  
Generalcall the both function in button click Pinmembersridhar214:47 3 Sep '07  
Questionshow with Link Pinmemberurgido12:21 19 Jul '06  
AnswerRe: show with Link PinmemberMassimo Beatini22:13 19 Jul '06  
QuestionRe: show with Link Pinmemberurgido20:34 25 Jul '06  
AnswerRe: show with Link Pinmemberurgido20:35 25 Jul '06  
AnswerRe: show with Link PinmemberMassimo 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-2009
Web12 | Advertise on the Code Project