Web Analytics Made Easy -
StatCounter Code Doesn't Work In Firefox!!!!!! - CodingForum

Announcement

Collapse
No announcement yet.

Code Doesn't Work In Firefox!!!!!!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Code Doesn't Work In Firefox!!!!!!

    Hey Guys,

    I am trying to make the text in the text box scroll up and down one line at a time onMouseUp every time i click the button. Currently, what it does is scroll continuously up and down once you roll over the buttons and that's not what i want. Also, it only works in IE and it doesn't work in FIREFOX (it just doens't do anything)!! Can someone help me with this as i am a beginner in Javascript. SEE CODE BELOW!!!!!!

    Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <script language='javascript'>
    		var _move = -1; // -1 = none, 0 = up, 1 = down
    
    		function Down() {
    			if(_move == 0)
    				return;
    			_move = 1;
    			setTimeout(function(){move_down();},64);
    		}
    
    		function Up() {
    			if(_move == 1)
    				return;
    			_move = 0;
    			setTimeout(function(){move_up();},64);
    		}
    
    		function move_up() {
    			scroll_clipper.scrollTop = scroll_clipper.scrollTop > 0 ? scroll_clipper.scrollTop - 4 : 0;
    			if(_move == 0)
    			    Up();
    		}
    
    		function move_down() {
    			scroll_clipper.scrollTop = scroll_clipper.scrollTop + 5;
    			if(_move == 1)
        			Down(); 
    		}
    
    		function clear_move()
    		{
    			_move = -1;
    			return;
    		}
    	</script>
    
    </head>
    <body>
    	<a href="javascript: void(0);" onmouseover='javascript:Up()' onmouseout='javascript:clear_move()'>
    		Move UP</a>
    	<div id='scroll_clipper' style='position: absolute; width: 150px; height: 150px; border: dashed 1px #000; overflow: hidden; top: 39px; left: 12px;'>
    		<div id='scroll_text' style='background-color: yellow;'>
    			<p>
    				Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque cursus turpis
    				id est. Morbi blandit. Nullam quam nunc, viverra ac, volutpat eu, dictum sit amet,
    				sem. Aliquam lorem nunc, luctus in, feugiat sed, tristique in, turpis. In nonummy.
    				Nulla eu orci. Ut ornare lobortis odio. Suspendisse vestibulum accumsan pede. Duis
    				eleifend nulla eu leo. Nam sem massa, varius vel, faucibus non, mattis sed, sem.
    				Vestibulum sagittis egestas ipsum. Suspendisse accumsan. Suspendisse libero nisl,
    				laoreet ornare, fermentum quis, scelerisque a, elit. Nulla dapibus, felis sit amet
    				vestibulum iaculis, massa lectus sagittis eros, at dapibus metus lectus fringilla
    				est. Donec id tellus. Fusce tortor. Etiam accumsan. Proin ipsum est, luctus ut,
    				sollicitudin et, posuere vitae, odio. Vivamus ac ligula sed felis pharetra porttitor.
    				Praesent nisl lacus, dignissim sit amet, ultricies et, adipiscing nec, velit. Donec
    				pellentesque blandit mauris. Integer iaculis, elit ut gravida dapibus, tellus lacus
    				auctor nibh, vitae ultrices nunc sem id tortor. Vestibulum a eros. Pellentesque
    				bibendum sapien id dolor. Pellentesque purus turpis, placerat quis, laoreet non,
    				ultrices id, est. Sed adipiscing nisi sed mauris ultricies ornare. Vivamus leo nisl,
    				fringilla vitae, vehicula nec, convallis et, est. Sed quis sapien in orci dapibus
    				vehicula.
    			</p>
    		</div>
    </div>
    	<a href="javascript: void(0);" onmouseover='javascript:Down()' onmouseout='javascript:clear_move()'>
    		Move DOWN</a>
    </body>
    </html>

  • #2
    Why should it? A name is not an ID. Firefox knows this. You should be using document.getElementById() and you can't have variables start with special characters.
    Code:
    		var move = -1; // -1 = none, 0 = up, 1 = down
    
    		function Down() {
    			if(move == 0)
    				return;
    			move = 1;
    			setTimeout(function(){move_down();},64);
    		}
    
    		function Up() {
    			if(move == 1)
    				return;
    			move = 0;
    			setTimeout(function(){move_up();},64);
    		}
    
    		function move_up() {
    			document.getElementById('scroll_clipper').scrollTop = scroll_clipper.scrollTop > 0 ? scroll_clipper.scrollTop - 4 : 0;
    			if(move == 0)
    			    Up();
    		}
    
    		function move_down() {
    			document.getElementById('scroll_clipper').scrollTop = scroll_clipper.scrollTop + 5;
    			if(move == 1)
        			Down(); 
    		}
    
    		function clearmove()
    		{
    			move = -1;
    			return;
    		}
    ||||If you are getting paid to do a job, don't ask for help on it!||||

    Comment


    • #3
      Hey thanks for the reply but that code still doesn't work in FIREFOX?

      Comment


      • #4
        It worked in Firefox for me. Are you sure you even have JS enabled?
        Tools > Options > Content > Check box next to javascript.
        ||||If you are getting paid to do a job, don't ask for help on it!||||

        Comment

        Working...
        X