User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Javascript/HTML question Page [1]  
tnezami
All American
8972 Posts
user info
edit post

Here's the scenario.

I want to make it easy for myself to download multiple images at once from Shutterstock (to get my money's worth.) I can download up to 25 images per day and it gets quite repetitious.

I wrote the following snippet of code:




Essentially, I enter the Image # in the left box of the table and click "go". This then loads the download page in the iFrame in the next column.

So far, all of this works. What I want to do now though is have the iframe automatically scroll down to the image verification part of the page.

What's the best way for me to do this?

*disclaimer* - I am in no way claiming to be an expert at jscript. I'm trying to teach myself as I go and I learn best by example.


In case you cant see the image very well, here's the code in question:

Function
<script>function goUrl(myField){
myVal=document.getElementById(myField).value;
document.getElementById(myField+'Frame').src="http://www.shutterstock.com/dl2_lim.mhtml?id="+myVal+"&size=huge_jpg&from_redirect=1";
}
</script>

Left Table Column
Image # <input type="text" name="box1">
<a href="javascript:goUrl('box1');">go</a>

Right Table Column
<iframe name="box1Frame"></iframe>[b]




[Edited on September 16, 2009 at 8:44 PM. Reason : .]

9/16/2009 8:38:21 PM

Golovko
All American
27023 Posts
user info
edit post

find if there is an anchor tag or id at the bottom of the page and use scrollIntoView (or whatever its called).

[Edited on September 16, 2009 at 8:42 PM. Reason : .]

9/16/2009 8:42:07 PM

tnezami
All American
8972 Posts
user info
edit post

I was using something like:

onLoad="moveTo(x,y)"

in my iFrame tag, but it was causing my entire page to move, and not just what was being loaded in the iframe. How do I fix this? I just want the page loaded in the iframe to move to the x,y specified.

9/17/2009 10:10:31 AM

Golovko
All American
27023 Posts
user info
edit post

You could go as far as using a javascript frame work to make your life easier. I know dojo, prototype and jQuery all have the ability to scroll to a specific x,y easily. Should also work in just the iFrame.

or


http://www.java2s.com/Code/JavaScriptReference/Javascript-Methods/scrollIntoViewExample.htm

[Edited on September 17, 2009 at 10:28 AM. Reason : oops forgot i had HTML]

9/17/2009 10:25:16 AM

hydro290
All American
1703 Posts
user info
edit post

The moveTo() method moves a window's left and top edge to the specified coordinates. You need to scroll the iFrame content.

Here's an example of scrolling the iframe's content window.

http://jsbin.com/ipujo/edit

[Edited on September 17, 2009 at 10:42 AM. Reason : :]

9/17/2009 10:28:22 AM

tnezami
All American
8972 Posts
user info
edit post

Duh, I'm an idiot. I meant that I used the scrollIntoView but it was making my parent page scroll, not my iframe.

9/17/2009 10:46:48 AM

 Message Boards » Tech Talk » Javascript/HTML question Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.