How to add scroll to this code

Discussion in 'Programming' started by cryoffalcon, Mar 23, 2011.

  1. #1
    Hi i would like an addition to this script as the link of the page i am attaching to it is having more longer height so i should be scrolled, but i don't know how to add scrolling option to this code
    
    window.onload = function() {
    	// check to see that the browser supports the getElementsByTagName method
    	// if not, exit the loop 
    	if (!document.getElementsByTagName) {
    		return false; 
    	} 
    	// create an array of objects of each link in the document 
    	var popuplinks = document.getElementsByTagName("a");
    	// loop through each of these links (anchor tags) 	
    	for (var i=0; i < popuplinks.length; i++) {	
    		// if the link has a class of "popup"...	
    		if (popuplinks[i].getAttribute("class") == "popup") {	
    			// add an onclick event on the fly to pass the href attribute	
    			// of the link to our second function, openPopUp 	
    			popuplinks[i].onclick = function() {	
    			openPopUp(this.getAttribute("href"));	
    			return false; 	
    			} 	
    		}
    	} 
    } 
    
    function openPopUp(linkURL) {
    window.open(linkURL,'popup','width=400,height=200')
    }
    
    
    Code (markup):
    this is the link to the post where i found this code http://www.openhosti...es/webdev/5918/
    thank you in advance
     
    cryoffalcon, Mar 23, 2011 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Add scrollbars=1 to the window parameters

    
    function openPopUp(linkURL) {
    window.open(linkURL,'popup','width=400,height=200,scrollbars=1')
    }
    
    Code (markup):
    Check out this page if you want to do anything else to the window.
     
    Cash Nebula, Mar 24, 2011 IP