www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 09-15-2005, 06:15 PM
    katydid katydid is offline
    Registered User
     
    Join Date: Aug 2005
    Posts: 30
    URL (NOT images) Slide Show with new window

    Is it possible with javascript to create a "new window" upon "submit" that, once open, then cycles through multiple websites (examples below are Dow Industrials),
    pausing for 4 seconds before advancing to the next website.
    Cycle continues until user closes "new window".

    Code:
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=AA
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=AIG
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=AXP
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=BA
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=C
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=CAT
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=DD
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=DIS
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=GE
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=GM
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=HD
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=HON
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=HPQ
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=IBM
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=INTC
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=JNJ
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=JPM
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=KO
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=MCD
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=MMM
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=MO
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=MRK
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=MSFT
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=PFE
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=PG
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=SBC
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=UTX
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=VZ
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=WMT
    http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=XOM
    Or, is this better addressed with language other than javascript? Please advise.

    Insight: if frequent amended 10-Qs are filed . . .
    Reply With Quote
      #2  
    Old 09-15-2005, 06:52 PM
    Ultimater's Avatar
    Ultimater Ultimater is offline
    Eccentric Tatertot
     
    Join Date: Jan 2005
    Location: Los Angeles, CA
    Posts: 4,827
    maybe something like this:
    Code:
    <style type="text/css">
    .hide{display:none;}
    .show{display:block;}
    </style>
    <script type="text/javascript">
    var timerId=null
    var intervalPause=3000
    var openNumber=0;
    var elList=[];
    onload=function(){
    getIds();
    timerId=setTimeout(daAnimationI,intervalPause)
    
    }
    function getIds(){
    var e;
    while(true){
    e=document.getElementById("w"+(elList.length+1))
    if(e)elList[elList.length]=e
    else break;
    }
    }
    function daAnimationI(){
    clearTimeout(timerId)
    daAnimation()
    timerId=setTimeout(daAnimationI,intervalPause)
    }
    
    function daAnimation(){
    elList[openNumber].className="hide"
    openNumber++;if(openNumber>=elList.length)openNumber=0
    elList[openNumber].className="show"
    
    }
    </script>
    <div id="w1" class="show">
    <iframe src="http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=AA" width="500" height="400"></iframe>
    </div>
    <div id="w2" class="hide">
    <iframe src="http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=AIG" width="500" height="400"></iframe>
    </div>
    <div id="w3" class="hide">
    <iframe src="http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=AXP" width="500" height="400"></iframe>
    </div>
    <div id="w4" class="hide">
    <iframe src="http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=BA" width="500" height="400"></iframe>
    </div>
    
    <div id="w5" class="hide">
    <iframe src="http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK=C" width="500" height="400"></iframe>
    </div>
    __________________
    Ultimater

    XMLHttpRequest:
    Specification | xmlhttp object | open and onreadystatechange order | String.prototype.toXMLDocument | Sarissa | Prototype | Dojo
    Broadening one's horizons:
    24ways.org


    Note I have a bad habit of editing my posts hours at a time and hours later.
    Reply With Quote
      #3  
    Old 09-15-2005, 09:30 PM
    katydid katydid is offline
    Registered User
     
    Join Date: Aug 2005
    Posts: 30
    Ultimater,
    You have exceeded expectations! Works perfectly.
    Hopefully this quick scan of the frequency of SEC amended filings proves useful in any future investment decisions.
    Reply With Quote
      #4  
    Old 09-15-2005, 09:53 PM
    Ultimater's Avatar
    Ultimater Ultimater is offline
    Eccentric Tatertot
     
    Join Date: Jan 2005
    Location: Los Angeles, CA
    Posts: 4,827
    Then we should use valid HTML and include all of your URLS.
    (please download the attachment and omit the ".txt" part)
    Attached Files
    File Type: txt companyTicker.htm.txt (6.7 KB, 52 views)
    __________________
    Ultimater

    XMLHttpRequest:
    Specification | xmlhttp object | open and onreadystatechange order | String.prototype.toXMLDocument | Sarissa | Prototype | Dojo
    Broadening one's horizons:
    24ways.org


    Note I have a bad habit of editing my posts hours at a time and hours later.
    Reply With Quote
      #5  
    Old 09-15-2005, 10:21 PM
    katydid katydid is offline
    Registered User
     
    Join Date: Aug 2005
    Posts: 30
    Ultimater,
    Thanks again!
    I made two changes in the attached:
    1) added id="w11" and renumbered remaining elements
    2) changed window dimensions.
    I really appreciate your help on this matter.
    Attached Files
    File Type: txt companyTicker[2].htm.txt (6.7 KB, 35 views)
    Reply With Quote
      #6  
    Old 09-15-2005, 10:37 PM
    Ultimater's Avatar
    Ultimater Ultimater is offline
    Eccentric Tatertot
     
    Join Date: Jan 2005
    Location: Los Angeles, CA
    Posts: 4,827
    Oh, flip, I can't count lol.
    __________________
    Ultimater

    XMLHttpRequest:
    Specification | xmlhttp object | open and onreadystatechange order | String.prototype.toXMLDocument | Sarissa | Prototype | Dojo
    Broadening one's horizons:
    24ways.org


    Note I have a bad habit of editing my posts hours at a time and hours later.
    Reply With Quote
      #7  
    Old 09-17-2005, 08:51 AM
    MjhLkwd MjhLkwd is offline
    Banned
     
    Join Date: May 2003
    Posts: 257
    Katy:

    Here's another approach, consistent with your initial goal of using a separate window for the rolling SEC pages.

    This window also has Pause and Continue buttons. The main page has a button to re-open the window if the user previously closed it. If the user closes the main page, the pop-up window also closes.

    I receive an error for the stock symbol HD, so I substituted MSO.

    I tested the code in FF and IE.

    Main document:

    Code:
    <HTML>
    <Head>
    <Script type="text/javascript">
    
    	var win10Q = "";
    	var winTogle = false;
    	
    	function open10Q(){
    
    		if (win10Q != ""){win10Q.close()}
    		win10Q = window.open('10Q.html','','toolbar=0,statusbar=0,scrollbars=1,menubar=1,resizable=1,top=100,left=400,height=200,width=350');
    		win10Q.document.title = "SEC 10-Q";
    		winToggle = true;	
    	}
    
    	function restart(){
    
    		win10Q = "";
    		winToggle = false;
    		open10Q();
    	}
    
    	window.onload=open10Q;
    	window.onbeforeunload=function(){
    
    		if (winToggle && !win10Q.closed){win10Q.close()}
    	}
    
    </Script>
    </Head>
    <Body>
    <input type='button' value='Re-start 10Q' onclick='restart()'>
    </Body>
    </HTML>

    Last edited by MjhLkwd; 09-17-2005 at 08:57 AM.
    Reply With Quote
      #8  
    Old 09-17-2005, 09:38 AM
    katydid katydid is offline
    Registered User
     
    Join Date: Aug 2005
    Posts: 30
    Mike,
    Thanks!
    I think I see where you are headed, but only ~25 lines of code are displayed above (just for one window?). I suspect there might be more . . .
    When you pre-viewed your post, was it all there?
    If so, then something got lost while making final publication.
    Please advise.
    Reply With Quote
      #9  
    Old 09-17-2005, 09:46 AM
    MjhLkwd MjhLkwd is offline
    Banned
     
    Join Date: May 2003
    Posts: 257
    Katy: Ouch! Sorry. Here it is again, both documents.

    Main:

    Code:
    <HTML>
    <Head>
    <Script type="text/javascript">
    
    	var win10Q = "";
    	var winToggle = false;
    	
    	function open10Q(){
    
    		if (win10Q != ""){win10Q.close()}
    		win10Q = window.open('10Q.html','','toolbar=0,statusbar=0,scrollbars=1,menubar=1,resizable=1,top=100,left=400,height=200,width=350');
    		win10Q.document.title = "SEC 10-Q";
    		winToggle = true;	
    	}
    
    	function restart(){
    
    		win10Q = "";
    		winToggle = false;
    		open10Q();
    	}
    
    	window.onload=open10Q;
    	window.onbeforeunload=function(){
    
    		if (winToggle && !win10Q.closed){win10Q.close()}
    	}
    
    </Script>
    </Head>
    <Body>
    <input type='button' value='Re-start 10Q' onclick='restart()'>
    </Body>
    </HTML>
    10Q.html:

    Code:
    <HTML>
    <Head>
    <Script type="text/javascript">
    
    	var URLstr = 
    "http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK="
    
    	var ticker = new Array('AA','AIG','AXP','BAC','C','CAT','DD','GIS','GE','GM','MSO','HON','HPQ','IBM','INTC','JNJ','JPM','KO','MCD','MMM','MO','MRK','MSFT','PFE','PG','SBC','UTX','VZ','WMT','XOM')
    	
    	var useWidth = screen.width-50;
    	var n = 0;
    	var pauseFlag = false;
    	var roll1 = "";
    	var first = true;
    	
    	function pauseRoll(){
    
    		clearTimeout(roll1);
    		pauseFlag = true;
    		n--;
    	}
    
    	function continueRoll(){
    
    		pauseFlag = false;
    		rollFrame();
    	}
    
    	function rollFrame(){
    
    		clearTimeout(roll1);
    		if (!pauseFlag && !first)
    			{
    			 if (n < (ticker.length-1)){n++}
    			 else {n = 0}
    			 roll1 = setTimeout("window.frames.secInfo.location.href = URLstr+ticker[n]",4000);
    			}
    		setTimeout('first = false',10);
    	}
    	
    	function setUp(){
    
    		document.getElementById('A').setAttribute('width',useWidth);
    		window.frames.secInfo.document.write("<font size='4'>Loading...</font>");
    		window.frames.secInfo.location.href = URLstr+ticker[0];
    	}
    
    	window.onload=setUp;
    
    </Script>
    </Head>
    <Body>
    <IFRAME name='secInfo'
    id='A'
    Src = ''
    onload='rollFrame()' 
    height='440'
    frameborder='yes' scrolling='yes'>
    </IFRAME>
    <br>
    <input type='button' id='pauseBtn' value='Pause' onclick='pauseRoll()'>&nbsp;&nbsp
    <input type='button' id='continueBtn' value='Continue' onclick='continueRoll()'>
    </Body>
    </HTML>

    Last edited by MjhLkwd; 09-17-2005 at 01:23 PM.
    Reply With Quote
      #10  
    Old 09-17-2005, 01:30 PM
    MjhLkwd MjhLkwd is offline
    Banned
     
    Join Date: May 2003
    Posts: 257
    Katy:

    Minor errors. Remove the commented line:

    Code:
    function restart(){
    
    		//win10Q = "";
    		winToggle = false;
    		open10Q();
    	}
    Keeping it will cause a new window to be opened if the user clicks "Restart" if the window is already open. Removing it causes the existing window to close prior to opening a new window.

    Also, a misspelling in the main document, this:

    Code:
    var winTogle = false;
    should be:

    Code:
    var winToggle = false;

    Last edited by MjhLkwd; 09-17-2005 at 01:33 PM.
    Reply With Quote
      #11  
    Old 09-19-2005, 03:17 PM
    katydid katydid is offline
    Registered User
     
    Join Date: Aug 2005
    Posts: 30
    Mike,
    Thanks for the alternate approach!
    This works well and is on the mark and fit for purpose.
    Regards,
    katydid
    Reply With Quote
      #12  
    Old 09-19-2005, 03:34 PM
    MjhLkwd MjhLkwd is offline
    Banned
     
    Join Date: May 2003
    Posts: 257
    katydid:

    You're welcome. There is one last change:

    In the 10Q.html document, in the rollFrame function, replace the last line with this:

    if (first){setTimeout('first = false',10)}

    make sure there is no semi-colon at the end of it.

    "first" only needs to be set to false once. Continuing to run that timeout every time the function is exectued is incorrect.
    Reply With Quote
      #13  
    Old 09-19-2005, 03:51 PM
    MjhLkwd MjhLkwd is offline
    Banned
     
    Join Date: May 2003
    Posts: 257
    katydid:

    There were two changes, but I forgot about the first one, because, truthfully, I assumed you weren't interested, because you didn't respond earlier today.

    Using the existing code, if a user clicks the pause button more than once while the first ticker is displayed, then n would be a negative number, and cause an error.

    Here's the corrected code for the function.

    Code:
    function rollFrame(){
    
    		clearTimeout(roll1);
    		if (!pauseFlag && !first)
    			{
    			 if (n < 0){n = 0}
    			 else if (n < (ticker.length-1)){n++}
    			 else {n = 0}
    			 roll1 = setTimeout("window.frames.secInfo.location.href = URLstr+ticker[n]",4000);
    			}
    		if (first){setTimeout('first = false',10)}
    	}
    Reply With Quote
      #14  
    Old 09-19-2005, 05:25 PM
    katydid katydid is offline
    Registered User
     
    Join Date: Aug 2005
    Posts: 30
    Mike,
    I went offline for a couple of days, hence the delay; thanks! for the followup.
    I made a few more changes for 10Q.html as shown in the complete code below based on error detection with "HTML-Kit" from www.chami.com.
    see:
    http://www.download.com/HTML-Kit/300...4-4687625.html

    Two warnings from running "Check Code Using TIDY", however, could not be resolved:
    "Warning", "1","44","57","0","'<' + '/' + letter not allowed here"
    "Warning", "2","44","74","0","'<' + '/' + letter not allowed here"
    These are likely of minor significance, though.
    Thanks again!
    katydid

    Code:
    <HTML>
    <Head>
    <Script type="text/javascript">
    
    	var URLstr = "http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q%2FA&owner=include&action=getcompany&CIK="
    
    	var ticker = new Array('AA','AIG','AXP','BAC','C','CAT','DD','GIS','GE','GM','HD','HON','HPQ','IBM','INTC','JNJ','JPM','KO','MCD','MMM','MO','MRK','MSFT','PFE','PG','SBC','UTX','VZ','WMT','XOM')
    	
    	var useWidth = screen.width-50;
    	var n = 0;
    	var pauseFlag = false;
    	var roll1 = "";
    	var first = true;
    	
    	function pauseRoll(){
    
    		clearTimeout(roll1);
    		pauseFlag = true;
    		n--;
    	}
    
    	function continueRoll(){
    
    		pauseFlag = false;
    		rollFrame();
    	}
    
    	function rollFrame(){
    
    		clearTimeout(roll1);
    		if (!pauseFlag && !first)
    			{
    			 if (n < 0){n = 0}
    			 else if (n < (ticker.length-1)){n++}
    			 else {n = 0}
    			 roll1 = setTimeout("window.frames.secInfo.location.href = URLstr+ticker[n]",2000);
    			}
    		if (first){setTimeout('first = false',10)}
    	}
    	
    	function setUp(){
    
    		document.getElementById('A').setAttribute('width',useWidth);
    		window.frames.secInfo.document.write("<font size='4'>Loading...</font>");
    		window.frames.secInfo.location.href = URLstr+ticker[0];
    	}
    
    	window.onload=setUp;
    
    </Script>
    <title></title>
    </Head>
    <Body>
    <IFRAME name='secInfo'
    id='A'
    Src = ''
    onload='rollFrame()' 
    height='510'
    frameborder='yes' scrolling='yes'>
    </IFRAME>
    <br>
    <form action=''>
    <input type='button' id='pauseBtn' value='Pause' onclick='pauseRoll()'>&nbsp;&nbsp;
    <input type='button' id='continueBtn' value='Continue' onclick='continueRoll()'>
    </form>
    </Body>
    </HTML>
    Reply With Quote
      #15  
    Old 09-19-2005, 05:39 PM
    MjhLkwd MjhLkwd is offline
    Banned
     
    Join Date: May 2003
    Posts: 257
    katydid:

    You are again, welcome. Forgive my wrong assumption.

    However, I'm not one to engage in this "validation," or "error checking," exercise.

    Recently, someone very astute, wrote in a thread, concerning "validation," that THIS site, this forum, when offered for "validation" returns more than 180 "errors."

    Hmm.

    That's all I need to know about "validation."

    Personally, if code WORKS, I don't look any further.

    I do understand that "validation" is very important to some, perhaps many.

    I bode no ill will toward them. Differences of opinion make the world go 'round.

    Good luck with the remainder of your project.
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 03:53 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.