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.
How does setTimeout work? If the user moves the mouse or types some text into a form, does it reset the timer? Or does it start running when first triggered and simply timeout after that amount of time?
For example, if the timeout is set to 5 minutes and after 4.5 mins, the user moves the mouse over the screen, does the timer reset to 5 mins or will it still timeout after another 30 seconds?
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 have the following function that's supposed to say "Please make a guess" 20 seconds after an initial confirmation is displayed. However, it's immediately displayed as soon as someone hits "Cancel". If I change it's time to 40000 (20 seconds after the initial function is called), it does do it 40 seconds total, so it kind of does what I want. So it seems that the second setTimeout is initiated from the time the script is called generally, but I'm looking for a way specifically to have the 20 seconds start only after the "cancel" button is hit.
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 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 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
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.)
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
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?
I 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.
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.
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?
I know this must be pretty basic but I can't get it to work. I've written validation for a text field- it should have no periods in it. I want to reset the value of the field then give the field focus, if it has a period. Here is my code:
Quote:
function checkTitle(field) { var titleFilter=/./; if (field.value.match(titleFilter)) { alert("Please enter your title without periods."); field.value='' field.focus(); return false; } else { alert("good"); } }
I call it from onChange. It resets the value but the focus goes to the next field (or stays there I guess.) Is there a way to set the focus on the same field?
PS I should mention, this form has disabled the "Enter" key and I can't change that behavior. I've been tbbing between fields, and it is when I tab that I am experiencing the problem.
I've got a form that is enabling/disabling other fields based upon radio selections. I've got it all working, except with the form reset button. My "refresh" routine just iterates through the radio box to check which item is selected based upon e[i].checked state and enables/disables accordingly. Unfortunately it seems the reset event fires before the actual state of e[i] has been reset and my form enabing/disabling gets out of sync.
var btn = document.getElementById('formData'); formValidation.addEvent(btn, 'reset', formValidation.refreshUI, false);
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