I've written a script that displays tooltips when your mouse hovers over a link - all this is fine, but when I click on the link and move to another page, then click the back button on the browser to go back, the tooltip for the link I clicked is still visible! It'd be great if there was a way of detecting the button had been pressed so that I can hide it...
p.s. I tried onclick = "tooltips.hideToolTip(4); return true;" for the links but no joy...
Why is it that you need the return keyword? Where does the argument event come from?
I know it works, I just want to know why it works.
I've been looking at some refferences and can't seem to find an answer if someone could give me an explanation or point me to a website, that would be great.
Is it possible to call a javascript function when the forward or back browser buttons are pressed? I have a site that loads content into iframes using javscript functions, however this means that the back button doesn't track the history of the user through the site.
I have a jquery-powered "start page" that checks your log in and if successfull it slides in a "menu" of new places to go. The problem is, if you click back from one of the new places, the original "start page" looks as if you never logged in. You have to reload the page. Not very intuitive and this website is for kids. Now I've tried setting form field values with server session variables, javascript variables, etc etc but they all get reset when you click back. I've tried the "onunload hack" which I don't fully understand, and then read a bit about the onhashchange event which is from what I gather only compatible with HTML5 browsers...is there no way to detect if the user is already logged in when they click the back button or am I not doing enough homework?
I'm looking to have a lightbox pop up when a user clicks the Back button in their browser rather than just navigating back. The purpose is to ask a question with a Yes/No answer, and if they click No, I allow them to go back. The only thing I've found anything like this is the onUnload event, but that doesn't prevent them from going back. How should this be handled?
I am trying to write a script that uses the IF statement to see wether or not a user clicked the back button to come to a page, and then if it's true to not let the page load and kick them back X number of pages (say 4) This is what I have so far:
I want to be able to find out what key the user pressed, rather than just that they pressed one. As far as i can see there is only functionality to get that the user pressed the shift key.
The idea I want here is when the user click on a character name from the drop down select bar at the bottom of the the form under case 1 and hits Add it is supposed to add it as a new LI in the UL that's under the drop down. Also what I woudl like to do is when the user as chosen all of the characters they want to I would like to insert the data into the insert tag inside my function at the bottom of this code strip and take the first character selected and put it into the insert with the column of default_char_id and default_news_id.
Right now when you click the right submit button next to the drop down all it does is go back to the default page I have set up.
does anyone know how I can test, in javascript, which of several buttons was pressed when submitting a form? Currently, I use the onSubmit event handler to call a form validator function, and it is in that function which I would like to test which submit button was pressed. Anyone know?
I'm trying through a form to display a loading gif when pressed the submit button. I've found on the net this code, but something is wrong. If a keep the id="form33" I can see my loading.gif displayed in place of the submit button, but nothing else happen, form not send. If I delete id="form33", I don't see anymore the loading gif, but my form is correctly sent and after few seconds ping2.php is opened..
This simple example shows where my problem is. It works fine when all mouse buttons are released, and also if a button is pressed outside the image. But if a button is pressed inside the picture it'll not call onmouseout when the mouse is brought outside the picture. The worst is it'll never call it, leaving the button stuck pressed forever until mouse is moved over it again.
I just noticed if I place the picture inside an A tag it does work fine then, but I don't need an A element here. Moreover, this fix appears to work only for IE6, IE4 still doesn't work properly. I'm asking if there's some other way to correct this. I'm also making this compatible with Netscape 4.5, and the presence of an A element changes the event.target.
The fact is I can't seem to disable the default drag'n drop of IE with pictures. Netscape 4.5 appears to work perfectly. By placing onmousemove="return false;" in BODY I aboid the cursor change in IE but nothing else.
I need a javascript that could record the ID/name of a textbox when the user hit delete or backspace to be used on the next page after submission in a PHP script.
There are 96 text boxes, they are all randomly placed on the screen with a question that came from a randomized array's keys (the script later checks the values of the textboxes with the values from the array's keys that correlate to the textboxes by the name/id of the textbox, which is assigned by a for loop that issues the next($array) to assign everything everywhere.
At the same time, it needs to count how many times the backspace/delete were pushed and have that recorded and sent as well.
After 45 minutes of research I've been able to solve the "count the backspace/delete key" problem:
<script type="text/javascript"> var count = 0; document.onkeypress=function(e){ var e=window.event || e
[Code]....
But onto the name/id issue: I'm not sure how to go about retrieving the names/id of the textboxes. I would assume a onkeypress event for every textbox, but hope that there could be something I could just add to this code.
I want to disable a function when a user is pressing control or command using Javascript. Is this at all possible? My reason for doing this is because I recently implemented lightbox to my script, but I still want users to be able to open the image in a new tab by just clicking control or command when clicking the image rather than opening it in lightbox (which it does).
I have a textarea where text can be entered and when pressing an image the copy sign will appear. When the copy image is pressed, it is only when the cursor is in the end of the text that the cursor comes after the copy sign.
When the cursor is put in the middle of entered text and the copy image is pressed, the copy sign appears in the end of the text. I would like for the sign to appear whereever the cursor is put and then focused right after the entered copy sign.
The code is:
<html> <head> <title>The Text Box</title> <link rel="stylesheet" href="style.css" type="text/css">
This is a proof of concept question ... that I've been unable to prove. Ultimate goal to is allow one button to have different actions with the Shift, Control or Alt key pressed for a link "<a...>" or a button ("<input type='button'" or "<button>.") click. The following appears to work in FF and MSIE on PC (with some side-effects), but not at all on a iMac using FF or Safari.
The display in the textarea shows that I can detect when the Shift, Control or Alt keys are pressed and an event is created with a mouse click. With a left mouseClick, the display shows
I have an application where at the top I have a div id="title" for the title then in the middle div id="map" I have the google map then bottom I have buttons div id="mainOption". So what I want is that I want another few div at the right. By default one of the div I will fill up with a combo box and and submit button. The problem I want the div only to be shown when I pressed the button at the bottom div.
I have a webpage popup (lets call it POPUP) which refreshes the opener window (this one we call PARENT) when we close it, saying we want to save data. For this, we use
top.oWndOpener.refresh();
When we don't want to save the POPUP data, we just close the popup and don't refresh the PARENT. In the PARENT we have a "Back" link which executes a simple
history.back()
The problem is: If we refresh parent, we need to go back 2 pages, because the refresh method adds another page to the history. But we have no (easy) way of knowing in the PARENT if it had been refreshed. With this, our users are forced to click two times in the Back link.
Is there anyway of going back to the previous page, no matter how many refreshes happened in the current one ?
I have been trying to utilize a pre existing snippet of JS that makes a call to some PHP, where the PHP echo's out the answer, namely a dynamic quick search output, that gains its data from an xml file (which works as expected) and thought I might be able to rework the code to work for my altered purpose (which has been a disaster at every attempt) which is as follows:
1. I have a JS file called call4section.js - JS that has a string (str) value assigned (could be number or a combination of numbers and letters) which is passed to a PHP script called call4section.php.
2. The PHP script takes receipt of the string and finds a match within an XML file for the entry under <reference>.
3. The XML file has a format as follows:
<pages> <note> <section>value</section>
[code]....
And well, I dont seem to be able to get any further forward with it. Effectively, I can echo out the $reply (if it worked I think), but my stumbling block is sending the starting string, with the JS expecting some reply sent from the PHP.
I want to use an onkeydown() on my web site and the web site to know which key I pressed. Specifically know I pressed the arrow keys and store which key was pressed in a variable.
The below is part of the codes of my image matching programme. The programme loads 2 different series of images in the area and the up/down button is supposed to change each set of the series of images. Currently, the codes only allow one set of the images to be changed. what can be done so that both set get changes when the up/down key is pressed?
Codes:
public void keyReleased(KeyEvent e) { zoom = false; repaint(); }
how do i make a html button stay down when pressed, until another button within a specified group of buttons is pressed, at which point it is released and the other button stays pressed?