• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

using javascript to open and scroll a webpage

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
using javascript to open and scroll a webpage
i am using

function open(){
   window.open("URL");
}
to open a webpage..and

function scroll(){
scroll = setInterval(function(){ window.scrollBy(0, 1000);
   
}
to scroll to the bottom of the page..
it works well when any one function is called on the onclick html button..but when i call two functions in a single button it is not working...not even open the webpage action..
my complete code is below

 
surya preethaaa
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
using this code..i can open a page but scrolling function is not working

 
Ranch Hand
Posts: 98
Angular Framework Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Surya,


You are not storing the window object reference value after the window.open(), so it's taking the current window to scroll.

Store the window.open object to the new value and use that object to scroll like below example

Fiddle https://jsfiddle.net/s4oohntv/



Note This approach will work only if your using same domain page in window.open. if your internet is slow increase the timeout seconds

 
surya preethaaa
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai Dinesh,
thanks for your response..
this code works fine for that URL..but it is not scrolling for url likelink
any idea???
 
Dinesh Kumar Ramakrishnan
Ranch Hand
Posts: 98
Angular Framework Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

surya preethaaa wrote:Hai Dinesh,
thanks for your response..
this code works fine for that URL..but it is not scrolling for url likelink
any idea???



Hi,

As i told early this scroll with work for the same domain pages. you cant control the other site like(twitter) form your javascript code.


Try with iframe or please post your javascript code in fiddle that wil help me to get more understand.
 
Listen. That's my theme music. That's how I know I'm a super hero. That, and this tiny ad told me:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic