DHTML Forum  

Go Back   DHTML Forum > dhtmlcentral.com > Off-topic
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06.02.2004, 23:52
zen zen is offline
Neuer Benutzer
 
Join Date: 06.02.2004
Location:
Posts: 3
Default

Hey you all. This is my first post. I'm working on a webpage for one of my class at school. I got two frames. One is the Main frame at which I want to be able to control the scroll from the second frame. So far i got this:

top.main.scrollBy(0,100) --> into an onmousedown event. (scroll down)
top.main.scrollBy(0,-100) --> (scroll up)

I want to know if it's possible to make the scrolling faster and smoother. Please post any new code up, cuz i'm still new at this and still willing to learn. Not much of a programmer myself but i'm hanging there.

Thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 07.02.2004, 15:16
Mark Mark is offline
Erfahrener Benutzer
 
Join Date: 28.02.2002
Location: Netherlands
Posts: 2.853
Default

Hi Zen, welcome to the forums.

It's good you are still willing to learn. I understand this is for a computer science project? Not to insult your teachers, but frames are considered a bad thing these days. The main reason for this is accessibility, and most of the times they also make a site larger in filesize.

Since you are new to webdevelopment, you better learn to build websites as we do it in the 21st century. Most webcourses I know of teach you how to create websites like it was 1999, using thrown-together markup, frames and tables. This is very bad for page size, accessiblity and, to some extend, usability (since usability also depends on design). I strongly suggest you search for tutorials on XHTML, CSS, seperating style and structure, webstandards and semantics. It will be quite challenging and in the end you'll become a modern webdeveloper.

Of course, if you don't want to build any more sites then just this one, it might be safer to go the old school way. If you use a What You See Is What You Get editor it will save you loads of time (WYSIWYG is a lot easier than handcoding, but the result is always worse). Then there's also the problem that your teacher might not support you learning XHTML and CSS... decide for yourself.

(On the XHTML versus HTML debate: I think there are more tutorials out there for clean XHTML than for clean HTML. Once XHTML is learned going back to good HTML shouldn't be a problem at all.)

- [url="http://neo.dzygn.com/"]Mark[/url:vcmptapadv]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 08.02.2004, 05:29
zen zen is offline
Neuer Benutzer
 
Join Date: 06.02.2004
Location:
Posts: 3
Default

Hey Mark,

I know that using frames can cause alot of troubles for search engines and book marking. But there is alot of new way to over come that. This website is just gonna be a personnel site about me. You see I want to be different and make my site kind of unique so that's why I decide to go with frames. Still I see some sites with iframes where you can scroll from an external source. I havent have much experience in javascript and still in the process of self learning myself. Anyways if anyone can come up with an idea please post up some example code of the present code that I had from up there.

Thanks,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 08.02.2004, 12:45
Mark Mark is offline
Erfahrener Benutzer
 
Join Date: 28.02.2002
Location: Netherlands
Posts: 2.853
Default

You can make the scrolling smoother by using a timeout (setTimeout) and scroll the page 10px. So in 1 second you scroll the page 10 times with 10px.

- [url="http://neo.dzygn.com/"]Mark[/url:bmw5pxk0gf]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 09.02.2004, 07:37
zen zen is offline
Neuer Benutzer
 
Join Date: 06.02.2004
Location:
Posts: 3
Default

Hey all,

I sort of figure out the scrolling frame thing. Here is the code that i used:

var ScrSpd=20 //Scroll speed
var speed=8 //Pixel to scroll per timeout.

var time=0;
var scroll=true;
function scrollUp() {
if(!scroll) {
top.main.scrollBy(0,-speed);
time = setTimeout("scrollUp()",ScrSpd)
}}
function scrollDn() {
if(!scroll) {
top.main.scrollBy(0,speed);
time = setTimeout("scrollDn()",ScrSpd);
}}
function noScroll(){
clearTimeout(time);
scroll = true;
speed = 8;
}

Please test this out and see if there is any errors or any suggestion that would make this coding better.

Thanks,
Zen 8)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 09.02.2004, 13:07
Mark Mark is offline
Erfahrener Benutzer
 
Join Date: 28.02.2002
Location: Netherlands
Posts: 2.853
Default

I don't have a test case for that, so you may do the testing . If the code works be happy with it. There are a lot of things you can learn about programming, but this small piece of code isn't worth the explanation. At least you seem to have gotten the usage of var right. Try to be more consistant with the semi-colons though.

- [url="http://neo.dzygn.com/"]Mark[/url:lv7viofnj9]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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

All times are GMT +2. The time now is 05:38.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.