SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Grapevine
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Write JSVar to text string not text box #2

    <html>
    <head>
    </head>
    <body>

    <script language="javascript">
    <!--
    function GetDivYCoord() {
    var intY = document.getElementById("main").scrollTop;
    document.Show.yCoordHolder.value = intY;
    }
    // -->
    </script>

    <!-- The following shows the scrollbar position in pixels as you scroll up and down: --!>

    <form action='test6.php?atd=1' method='post' name='Show'>
    <input type='text' name='yCoordHolder' style='width:50px' value=''></form>

    <!-- What I need is to be able to display the following: --!>

    <script language="javascript">document.write(intY)</script>

    <!-- This is the code that triggers dynamic scrollbar positionin pixels: --!>

    <div id="main" style="height:260px; scroll:auto; scroll-y:auto; scroll-x:hidden" onscroll="GetDivYCoord()">

    </body>
    </html>

  2. #2
    SitePoint Evangelist vikrantkorde's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai, India
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this one.
    Code:
    <html>
    <head>
    </head>
    <body>
    
    <script language="javascript">
    <!--
    function GetDivYCoord() {
    var intY = document.getElementById("main").scrollTop;
    document.Show.yCoordHolder.value = intY;
    // added Vikrant Korde
    document.getElementById("test").innerHTML = intY;
    }
    // -->
    </script>
    
    <!-- The following shows the scrollbar position in pixels as you scroll up and down: -->
    
    <form action='test6.php?atd=1' method='post' name='Show'>
    <input type='text' name='yCoordHolder' style='width:50px' value=''></form>
    
    <!-- Here the value of the intY will be printed -->
    <span id="test" ></span>
    
    <!-- This is the code that triggers dynamic scrollbar positionin pixels: -->
    
    <div id="main" style="height:260px; scroll:auto; scroll-y:auto; scroll-x:hidden; border:1" onscroll="GetDivYCoord()">
    </body>
    </html>
    Vikrant Korde
    S Y S T I M E, Mhape,
    Mumbai, Maharashtra, India.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •