OnClick - Controlling Original Button Mouseout

Mar 5, 2009

I am trying to build a Menu that will have a mouseover effect and when clicked will hold the mouseover image on mouseout. The problem I'm having is that when another menu item is clicked it will not reset the original button's mouseout and if the mouse ever touches it again it will, again, hold the mouseout image. I am aware that It would be easier to just use different pages, but I am wanting to eventually have hidden containers with further menu options drop down from the menu (just trying to explain why it needs to hold the image within the same page).

Here is the function that I have built so far(it doesn't work and I know there are some obvious problems with it, I'm mainly just trying to convey the logic I have used thus far). I am a new javascripter, and my experience is mainly with C#. I am trying to use document.(objectname).src as if it were a variable because It should have a value to return. I'm trying to store the mouseover image in var i, reset all the buttons and then put i(should be the mouseover image)back in the (objectname).src. This probably isn't allowed in javascript, but I left it so you can see how my mind is trying to accomplish this task.

Here you go:
function ClearMenu(xx){
var i
i = xx.src
document.news.src='news.jpg'
document.events.src='events.jpg'
document.press.src='press.jpg'
document.aboutus.src='about.jpg'
document.contact.src='contact.jpg'
document.join.src='join.jpg'
document.news.onmouseout="document.news.src='news.jpg'"
document.events.onmouseout="document.events.src='events.jpg'"
document.press.onmouseout="document.press.src='press.jpg'"
document.aboutus.onmouseout="document.aboutus.src='about.jpg'"
document.contact.onmouseout="document.contact.src='contact.jpg'"
document.join.onmouseout="document.join.src='join.jpg'"
xx.src = i
xx.onmouseout = i
}

My attempt to Call this function would look like this:
<img src="news.jpg" name="news" id="news" onmouseover="newshov.jpg" onmouseout="news.jpg" onclick="ClearMenu(news)"

View 7 Replies


ADVERTISEMENT

Mouseover, Mouseout And Onclick In A <TD>

Jul 20, 2005

I am trying to accomplish a task that i thought would be easy -
and at this point - i'm starting to wonder...

I have a table setup, one column, ten rows

All the cells start off with a white background,
as the mouse passes over the cell, the background color
changes to a nice light blue. I have that working ok -

but the trick comes in as - when a user clicks in the
cell - i would like to change the background color to silver,
and when the user moves the mouse off of the cell - the background
will stay silver, until the user clicks another of the cells,
then that cell switches to silver, and the rest of the cells turn
to white

View 1 Replies View Related

Mouseover, Mouseout And Onclick Events

Jan 29, 2007

I am reading values from a database into a table and I have it so that when the mouse is over a row the row is highlighted blue and when the mouse exits that row the row becomes white again - straight forward.

each row also has a check box with an onclick event and ultimately I would like when the checkbox is checked the row to be highlighted red and remain that colour. The problem is that the mouseover and mouseout events still fire. Is there way to disable these when the box is checked? Code:

View 14 Replies View Related

Accidentally Deleted The Original File - Convert The Encoded File Into The Original Version?

Dec 17, 2009

I have encoded same javascript file with "Microsoft script encode" and accidentally deleted the original file.There is a way to convert the encoded file into the original version.. The form of the encoded file is : <script type="text/jscript.encode">#@~^.....

View 5 Replies View Related

OnClick = Disable Button - Text In Form = Enable Button

May 19, 2009

I have a message system that I want to prevent double posting. So when a user sends a message i would like to disable the button. But its done using AJAX and will load without much time. But enough to cause double clicking. So now the button needs to be enabled once Text is put in the Form Field.

View 2 Replies View Related

OnClick Event Of Button 1 By Pressing Button 2

Jul 23, 2005

I am wanting to fire the onClick event of button1 by pressing button2.

Does anyone have a clue if this is even posible?

View 3 Replies View Related

JQuery :: "Back" Button Breaks "mouseout" Event?

Mar 27, 2010

I have bound the "mouseover" and "mouseout" events to an element to swap the background image and create a rollover effect.It works well, except that the image region also contains a link. When the user clicks the link, they navigate to the new page. If they move the mouse, and then click the browser's "Back" button, the original page appears - but with the rollover image still showing because "mouseout" was never called, even though the cursor is no longer over the element.

View 1 Replies View Related

Two Events With One OnClick Of A Button

Sep 12, 2007

I have the following code which places multiple buttons on a page. I need 6 of the 7 buttons to perform two actions on one click. I have searched the web and can't quite comprehend the suggestions that I find. (I'm a newb). :confused:

Is it possible to just onClick=action1 & action2?

Here's the code. I seperated the head from the body to reduce the amount of scrolling....

View 2 Replies View Related

Onclick In Submit Button

Sep 13, 2005

I have a form that takes the form data and sends users to a certain page when clicked on

however i now what to add another button to that form. this one does not need to use the form data it just needs to send them to another page

i tries this but with no luck

<input type='submit' value='Delete Profile' onClick='top.location.href=http://localhost/GIG/index.php?page=edit_profile&stage=5' class='button'>

<input type='submit' value='Preview Profile' class='button'>

how should I use the onclick effectively?

View 7 Replies View Related

Change The Onclick Of A Button?

Apr 14, 2010

I want to click a button called 'view report' and then depending on a value of a text field on the page the form will be directed to different php pages.

Code:
<input name="viewreport" type="submit" value="View report"onclick="workOutWhichReport()" />
</div>

[Code]....

I think the problem is that because the javascript has to be outside the form to read the text field value it can't execute on the form properly

View 1 Replies View Related

How To Change Button Value OnClick

Apr 22, 2011

How do I change the Button's value onClick?I want it to initially be "Read More" and then change to "Show Less"

<script type="text/javascript">
function toggleMe(a){
var e=document.getElementById(a);

[code].....

View 4 Replies View Related

Onclick For Right Mouse Button?

Feb 22, 2010

The idea is that I've got a bunch of images, and I want one thing to fire when left-clicking them and a different thing when right-clicking. For the purpose of this thread I've replaced the 'things' with alerts.this is the part that gets added to the images (called 'plaatje'):plaatje.onclick = klik;

this is the function that gets executed when clicked.
function klik(event) {
var fotoID = event.target.id;

[code].....

View 6 Replies View Related

Button Onclick Not Working?

Jan 2, 2011

Code:
var submitbutton=document.createElement("input");
submitbutton.type="button";

[code].....

View 7 Replies View Related

Adding An Onclick To A Select Button?

Jan 27, 2009

I have these following code:

<img class="sptr" src="/picts/separator.gif" width="6" height="20" alt="">
<img class="imgbtn" src="/picts/in_image.gif" width="21" height="20" alt="" onClick="wrapText(document.getElementById('TheTextArea'),'','');">

[code]....

As you can see the image has an onclick associated with it.I want to do a similar thing with the selection of the font-size.As the action needs to occur after the client has selected the size, probably I will need "on buttun up" ( or is it onRelease ? ) this one <select name="x_size"> ?or on all the option statements ?

View 5 Replies View Related

Disable Submit Button After Onclick?

Nov 23, 2009

I have the following code:

<input type="button" name="button" value="Submit"
onclick="javascript:get(this.myform);">

How can I change this to make this button disabled after the onclick?

View 1 Replies View Related

Button OnClick Event Does Not Work?

Sep 21, 2010

I have identical code in my index that works, so I'm just guessing the error is somewhere else, I know IE is not the best target to aim for - but I really want this to work in the windows default browser....

Here is the php page...
<HTML>
<HEAD>
<TITLE>[code]....
and here is the javascript that works in the index but not here...
function Abort()
{
document.location="AddFamilyMember.php";
};

When I load the page everything looks ok, but click on the abort button, and all that happens is that the little error symbol pops in the lower left of IE. The names of the two files are "AddFamilyMember.php" and "AddFamilyMember.js".

View 1 Replies View Related

Onclick With Radio Button And Image?

Mar 22, 2011

I just started my javascript class two weeks ago and am having troubles already and my book is no help.

My first assignment is having a list of country names and when you click the radio button next to the name the country flag pops up in a designated area for the image. I have tried a few different things but nothing is working. I have the list of countrys and the radio buttons but when i click the radio button the image doesn't pop up. Also, when i click another radio button they all stay selected.

View 5 Replies View Related

Button Onclick Event Not Firing?

Apr 13, 2011

I am using 2 ajax functions in the program. One for login and one for logout.The login one is showUser which is working correctly by using the form onsubmit method, however the logout button (IN BOLD) onclick method is not working.

<form onsubmit="showUser(document.getElementById('uid').value,document.getElementById('pass').value);return false;" >
<div id="txt"><b>Enter your username </b>
<input type="text" name= "username" id="uid">[code].....

View 6 Replies View Related

Button Impression Onmouseover And Onclick

Dec 20, 2006

First off, I know very little javascript. I was wondering how to make a button (an image acting as a link instead of text) impression when the user goes over it and when the user clicks it.

View 4 Replies View Related

Php - Run A Php File Using Js - Using The Event Button Onclick

Oct 26, 2011

Trying for a few days to do this and do not know why it does not work. I want to run a php file using js. And using the event button onclick.

file.php

View 1 Replies View Related

Radio Button Onclick Change Url?

Nov 20, 2009

I have a radiobutton set of 2 radiobuttons... I want to be able to change url if the radiobuttons are checked. How do I go about that.I have figured out that I need to use the onClick handler, but cant firgure out how to change the url..

View 2 Replies View Related

Making Button Disabled WITHOUT Using OnClick?

Jul 26, 2010

When a button is clicked, the button then disables (as well as running its normal function).Obviously I'm used to using this.disabled=true but in this instance I cannot access the onClick in the <input> tag because the page is hard coded by a third party application.So I'm trying to make a function which locates the button, notices if it's been clicked and disables it on click. Seems easy to me! However I cannot make it work!Here are the two variations I've tried (both call the function in the page onLoad):

function disableButton() {
document.getElementById('submit').onclick=document.getElementById('submit').disabled=true;
}

[code]....

View 2 Replies View Related

Need OnClick Javascript Code For Button

Aug 10, 2005

I have a 3-state rollover: home.gif, homeover.gif, and homeclick.gif

I would like to make the homeclick image be selected when going to the page it pertains to.

The way I'm doing it now, is I'm just changing the image for that particular page, to homeclick instead of home.gif, but I know there's a better way, isn't there?

View 5 Replies View Related

DOM, Setting Onclick To Button In IE Not Working

Mar 17, 2006

I'm having a strange problem with the onclick attribute on a button not working in IE, it works fine in Firefox.

Basically using Javascript I'm creating a button input and setting the onclick to call some othe Javascript. Yet when I click the button it does not call the function. Code:

View 4 Replies View Related

Button Onclick Enable Textboxes?

Jul 4, 2009

I have a table generated from a mysql query.Essentially I want to have an edit button on each row. When clicking this button, it will turn all the text in that row into textboxes whose values are the corresponding texts that they have replaced.Additionally, a submit button would pop up to submit the edit.For example, if you had a setup like below...

EDIT || name || email
...and clicked "EDIT", then you would have
EDIT || textbox value="name" || textbox value="email" || button value="submit"

I have come across several tutorials while trying to figure this out,Unfortunately, my JS skills are seriously lacking. I have a degree in math/cs, but we never even touched it. I am normally very against just asking for code and not providing much as a poster, but I think this is probably an easy question, and I have no idea where to even start.Here's what I have in php...

$i++;
$form_name = "form" . $i;
<form id="$form_name" name="$form_name" onsubmit="return false;">

[code].....

View 1 Replies View Related

Fad Out A Table With Script Onclick Button?

Oct 9, 2011

I need to make a table fadeout with JavaScript when I click a button. [code]...

There is a button that calls a function called fadeout(). I cannot find a way to make the table fade out with just that one function.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved