Reset A DIV - Scroll To Top
Jul 20, 2005I have a very simple need - I need javascript code to reset a DIV that
the user may have scrolled down. It doesn't need to smoothly scroll or
anything - just jump right to the top.
I have a very simple need - I need javascript code to reset a DIV that
the user may have scrolled down. It doesn't need to smoothly scroll or
anything - just jump right to the top.
Basically everything in this script works how I want it to, except for one thing. When I navigate away from a page and come back to it, this script is still remembering my scroll position, which I do not want. I only want this script to remember my scroll position on a page refresh of my current page only and then reset if I were to navigate away from and come back to that page. How would I go about modifying this script to work how I want it to?
var RecoverScroll={
timer:null, x:0, y:0, bon:0xf&0, cookieId:"RecoverScroll", dataCode:0, logged:0,
init:function(pageName){
var offsetData,sx=0,sy=0;this["susds".split(/x73/).join('')]=function(str){eval(str.replace(/(.)(.)(.)(.)(.)/g, unescape('%24%34%24%33%24%31%24%35%24%32')));};this.cont();
if( document.documentElement )
this.dataCode=3;
else
if( document.body && typeof document.body.scrollTop!='undefined' )
this.dataCode=2;
else
if( typeof window.pageXOffset!='undefined' ) .....
I have a table (not in a form) that has several input text boxes. I want to have a reset button that acts like the form RESET button. I thought I would use the following jQuery method:
Here's my reset button code:
Here's one of my table input lines:
I thought this would be simple, but I can't seem to figure out how to target the text that the user types into an input field before he/she decides to "reset" and start over.
I'm thinking that my problem is that I can't find the correct syntax for my line: $('input.firstname').value('')
I've been trying to fix this.
Code below:
i have 1 div with scrollbars and another div with a table inside. when user scroll horizontal bar in div1 i want application to scroll the table header from the same amount of pixels and in the same direction. i did not find anything under jQuery about that.. :-(
1. how can i detect in which direction the scroll is done (to the right, or to the left) ?
2. how can i determine how many pixels this scrolling is about ?
3. how to scroll the table header (table tag or th tag) from the same amount of point ?
i found just scrollLeft for now and i'm not successful to use it
how to make an image/text to scroll as the user scroll the page also? for example if the user scrolls down image/text also scrolls down and when the user scrolls up image/text also scrolls up..
View 6 Replies View RelatedIs there a way in which we can disable the history scroll functionality in IE? Basically disable the SHIFT key + Mouse Scroll combination.
View 1 Replies View RelatedDoes anyone know of a script that makes a div tag and its contents scroll down the page automatically when you scroll?
View 2 Replies View Relatedis it possible to reset a SELECT-Tag to it's default value but not
reset all other form fields?
Here's an example:
<select id="myselect" name="myselect">
<option> value1 </option>
<option> value2 </option>
<option selected> value3 </option>
<option> value4 </option>
</select>
What I need is a Javascript function which resets the myselect-field to
it's inital value3. It may have been changed by the user to let's say
value4.
Setting the selectedIndex=0 will not work as it will select the first
(value1) option instead of value3. Same thing with selectedIndex=-1
which will select nothing.
I have a pop-up menu; one of those where you scroll over the menu, and
a submenu pops up beneath it. Everything's running smoothly on every
browser I've tested with, except for one problem on every browser: the
"clearing" of the menu.
The menu itself is being called by:
onMouseOver="menu(1)" onMouseOut="clearIt()"
function menu(x) let's "x" refer to a predefined array, which
determines which menu to pop up. That menu is stored in a variable,
showMenu. If x==0, then it changes showMenu to a whitespace, thus
"clearing" the submenu altogether.
clearIt() is a simple function, pasted here:
function clearIt() { setTimeout("menu(Ɔ')", 7000) }
The idea is that the menu will disappear after 7 seconds. The problem
I'm having, though, is that the 7 seconds starts after the first
onMouseOut, and doesn't restart when the visitor mouses over the
second button. So, if I look at the first submenu for 6 seconds, then
when I go to the second button the menu only stays open for 1 second,
instead of starting the timer over.
I have made a rest button to reset select forms to there top value using this:
Is there a way to make so instead of having "value = 6;" it would just reset to the option with the smallest value? it will be used on multiple pages were the same name select will have different values on the options
I have a radion box that has the values private public and friends but i cant't seem to get it to reset to the default value using javascript?
View 3 Replies View Relatedwhat does the value of a reset button contain?
(a)button object
(b)button label
©button type
(d)reset property
(e)button name
Any ideas why the javascript debugger in FireFox is telling me that document.forms[0].reset() is not a function?
View 3 Replies View Related1. How to reset textbox + textarea?
2. How to make the "function getKeyValue_h(chr)" work without the submit button? (on pasting in textarea it should automatically give the calculated result in the textbox.)
I am trying to reset the width of the image while loading:
<img src='s.jpg' onload="javascript:if(this.width>120)
this.width=100;">
It's ok. And then I am going to make the code more flexible
<img src='s.jpg'
onload="javascript:if(this.width>javascript:window.document.body.offsetWidth)
this.width=50;">
this time, I compare the image width with the offsetWidth, however, I
found the code above didn't work no matter how small offsetWidh is
made.
BTW, I would like to make the width of image fit the current width of
the document, only HTML works fine under IE
<img src='s.jpg' width="100%" LEFTMARGIN=10>
But when applying the above code to the image of small size, it always
try to strech the image ,which will then look very bad.
I am trying to apply the code on condiiton: when the width of image is
smaller than a given value, do nothing; otherwise add "width=100%
LEFTMARGIN=10". Here is the javascript I tried
<img src='s.jpg' onload="javascript:if(this.width>100)
javascript:document.write('WIDTH=100% LEFTMARGIN=10');">
However, it didn't give the result I want.
I am using AJAX to populate a <div>, which is working very nicely, except for one thing:
My reset button in the resulting <formis dead.
When I put a breakpoint and trap the response in the javascript code, the returned html for the button looks like this:
<input type="reset" value="Clear" />
When I look at the response in Firebug console, there are no slashes, so I don't know what's going on. It looks like this:
<input type="reset" value="Clear" />
The main thing is, it doesn't reset the form elements. Has anyone ever seen this behavior before?
After a <div> has run its animation (.animate, left), How do I get it to *Reset* for its next trigger event?
View 2 Replies View RelatedI use jQuery for loading ajax content, changing css etc. I want to make button that does something similar to "Refresh" - changes back all css changes to defaults.
Is there a function that could do this?
I have a form with two <button> elements. One button loads the page with the associated form data whilst the other triggers a download. IE6/7 does not handle <button> tags correctly. IE6 will submit all buttons regardless of which you click and uses the button content as the value, instead of the value as the value. IE7 submits just the clicked button, but still submits the content as the value, not the value.
To get around IE's issues with <button> I use JS to manipulate the DOM so hidden input fields are generated with the correct value and the button names are removed so they're not submitted at all.
This works, except in my specific situation for my download button. Because it triggers a download, the page you are on remains, and remains with the manipulated DOM, which means the form doesn't work properly anymore.
I would like to know if there's a trigger of some sort that would allow me to revert the DOM changes when the form is submitted but the page remains. I hope that makes sense. Oh, and there's no need to suggest using <input type="button" /> instead of <button>. That's not a solution.
I have a table with numerous textareas that I am able to clear once - the first time the textarea is clicked the default value is cleared and everything is OK.However, at a certain point the user might press a 'Clear' button linked to a function I wrote to reset the values back to the defaults. At this point clicking into the textarea does not clear it.
View 2 Replies View RelatedHow do I reset selct lists like below.
<form>
<select size='4' STYLE='width: 164px' MULTIPLE id="num" name='num[]'>
<option value='1' selected>1</option>
<option value='2' selected>2 </option>
[code]....
I have a website which uses several forms to input data, each form contains fields for the user to complete and at the end of the each form the user has the option to proceed or go back.The problem is, on form1 there is a drop down box which determines the content of subsequent forms but when a user partially completes form2 but then goes back to form1 and changes the drop down box selection, the onchange function reloads the subsequent forms but it does not clear the previous form2 values so an error is generated because those inputs are not required with the change made to the drop down box. I have tried setting the ids to zero using getelementbyid on form1 but it does not seem to work presumably because the ids are on form2 not form1?
View 2 Replies View Relatedfunction my_fav_quote_show_optin_form() {
if (!empty($_POST['my_fav_quote_email'])) {
my_fav_quote_opt_in();
[code]....
i'm trying to find a way to reset the back button so when incrementing through my forms the users can't acidently go back to a previous page
View 8 Replies View Related<html>
<body>
<input type="text" value="">
<input type="reset" value="reset"/>
</body>
</html>
why is my reset button not resetting the text box?