Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old July 29th, 2004, 09:37 AM
sam sam is offline
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by anshul
 4Netscape family corresponding property is 'pageYOffset' lieu 'document.body.scrollTop' that works4 MSIE. We need if..else or seperate function body4this distinction.

setTimeout("scrollMenu(str)",100);
is one correction i do now.

there may b more typing mistakes.
I was unable to implement your code but I think I totally off base please clarify:
Code:
<html>
<head>
</head>
<body>
<div id="menu" style="width:100;height:100;background-color:black"></div>

<SCRIPT LANGUAGE=javascript>
<!--
var initpos, scroll, newpos, str;

function initScroll(menu) {
 str=eval('menu');
 initpos=parseInt( 
  document.getElementById(str).style.top);
 }

function scrollMenu(menu) {
 scroll=parseInt(document.body.scrollTop);
 newpos=pos+scroll;
 str=eval('menu');
 document.getElementById(menu).style.top=newpos;
 str=eval('menu');
 setTimeout("scrollMenu(str)",100);
 }

//now u just need2call functions externally

initScroll('scrollMenu');
scrollMenu('scrollMenu');
//-->
</SCRIPT>




<TABLE WIDTH="75%" BORDER=1 CELLSPACING=1 CELLPADDING=1 height=900>
    <TR>
        <TD>1</TD>
        <TD>2</TD>
        <TD>3</TD>
    </TR>
    <TR>
        <TD>4</TD>
        <TD>5</TD>
        <TD>6</TD>
    </TR>
    <TR>
        <TD>7</TD>
        <TD>8</TD>
        <TD>9</TD>
    </TR>
</TABLE>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~
http://byldesigns.com
~~~~~~~~~~~~~~~~~~~~~~~
Reply With Quote
  #12 (permalink)  
Old July 30th, 2004, 03:06 PM
Friend of Wrox
 
Join Date: Mar 2004
Location: Bhopal, MP, India.
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul
Default

hi sam,

u need hust define these functions in <HEAD> or seperate .js file.
create a <DIV> with id="scrollMenu"

call the functions then.
please try. u'll get it2work.
Reply With Quote
  #13 (permalink)  
Old August 4th, 2004, 09:51 AM
sam sam is offline
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the lead, I needed to make the div "POSITION: absolute " plus I fixed some typos.
Code:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<SCRIPT LANGUAGE=javascript>
<!--
var scroll, newpos, pos;
newpos=0;
function initScroll(menu) {
    pos=parseInt(document.getElementById(menu).style.top);
 }

function scrollMenu(menu) {
 scroll=parseInt(document.body.scrollTop);
 newpos=pos+scroll;
 document.getElementById(menu).style.top=newpos;
 setTimeout("scrollMenu('scrollMenu')",100);
 }

//-->
</SCRIPT>

</HEAD>
<BODY>

<div id="scrollMenu" style="Z-INDEX: 100; LEFT: 880px; WIDTH: 100px; POSITION: absolute; TOP: 198px; HEIGHT: 100px; BACKGROUND-COLOR: black"><A HREF="http://www.ebcpro.com"><center><BR>click here for help</center></A></div>

<TABLE WIDTH="75%" BORDER=1 CELLSPACING=1 CELLPADDING=1 height=1900>
    <TR>
        <TD>1c</TD>
        <TD>2</TD>
        <TD>3</TD>
    </TR>
    <TR>
        <TD>4</TD>
        <TD>5</TD>
        <TD>6</TD>
    </TR>
    <TR>
        <TD>7</TD>
        <TD>8</TD>
        <TD>9</TD>
    </TR>
</TABLE>
<SCRIPT LANGUAGE=javascript>
<!--

initScroll('scrollMenu');
 setTimeout("scrollMenu('scrollMenu')",100);
//-->
</SCRIPT>


</BODY>
</HTML>
~~~~~~~~~~~~~~~~~~~~~~~
http://ebcpro.com.com
      where EveryBusinessCounts
~~~~~~~~~~~~~~~~~~~~~~~
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript with <div> aware Javascript How-To 3 August 25th, 2005 05:57 AM
<marquee> scrolling swastikagaur HTML Code Clinic 2 March 30th, 2005 03:56 AM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
sizeable <div> johnjohn Javascript How-To 1 December 8th, 2004 08:28 PM
<A><DIV><TABLE></DIV></A> anshul HTML Code Clinic 2 July 17th, 2004 02:17 PM



All times are GMT -4. The time now is 09:00 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.