JavaScript Menu With Alternating (onclick) Button Images

Mar 20, 2007

I am new to JavaScript and have been plugging away at it trying build a menu for site I am developing. My colleague has suggested I use Flash, which I could, but I think it is unnecessary and JavaScript is ideal for this use.

I have been building a menu that has a sub menu that appears below all of the main menu items. I have got this working and will include the code I used to do this below.

Now I want to change the button image so that it is visible which sub-menu the items that appear below belong to. Code:

which was very helpful and with some playing around I can now get my existing menu to complete part of my task. But I have 4 menu items and therefore need to use a "var" command to allow me to define different button images for different menus. Code:

View 2 Replies


ADVERTISEMENT

Javascript Menu Not Loading Images

Jul 23, 2005

I have created a Javascript menu for my site which uses frames. The first
stage loads fine but I want two drill down menus ("About Me Menu" and
"Projects Menu"). The pages load fine, but the images aren't displayed,
instead the alt text is shown. The images come up after you "Mouse Over"
them but not before......can anybody spot any errors in my code which could
be doing this please. For info, I have 4 images for each button, to take
into acount whether the button had been used and to give a mouse-over image
for each state. I have also deleted the code for items 3-5 as they are
commercially sensitive. Code:

View 10 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

Javascript Onclick Event On Submit Button

Oct 6, 2005

I created a "cancel" button for my form at the clients' request, I
accidentally copied a submit button and added an OnClick event- a very
simple javascript.history function. It did not appear to work at all-
it kept submitting the form. I changed the submit button to a plain
old button and it worked fine.

Can anyone explain how the browser works with a javascript onClick
event ona submit button? Does it automatically submit the form no
matter what onClick event you use?

View 2 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

Alternating Background Colors: JS V PHP

Oct 24, 2010

Out of pure curiosity: Assuming tabulated data in HTML is being generated by a PHP script, would it be better to alternate each row's background color with PHP or rely on JS to do it? One is run client-side and the other server-side so my guess you have to take the whole web app as a whole and see which side should be spared the additional workload. Is it situational or is there an absolute rule? In a vacuum, I guess you could argue PHP would be better since it cannot be turned off in the way JS can (unless plugins like NoScript can block PHP as well), but I don't have enough experience with either to be sure.

View 7 Replies View Related

Alternating Message Text Box?

Feb 27, 2010

I have this alternating text box working, but I still have some problems.

when I add this line (in the style section)
textarea.test {
width: 350px;

[code].....

View 7 Replies View Related

How To Create Alternating Image With Target

Dec 29, 2005

How can i create an alternating banner image using javascript with each image has its own url target. and uses cookie to display.

View 2 Replies View Related

Alternating CSS Stylesheet - Cookie Part?

Jul 27, 2011

so I have this script that alternates my CSS stylesheets and it's working great. The thing is, there was a cookie coding that was included but it doesn't work. Basically what I want to do is that the browser remembers which stylesheet the user had chosen and keep it the same for all pages, for a determined period of time.

Here's my code:

[Code]...

View 2 Replies View Related

How To Give Table Alternating Row Colors

Jun 11, 2010

I read this article: [URL]...I want to Combine this example with the example given in Part 1 to give this table of revenues alternating row colors!

Here are my combining codes: It is quite clear there must be something with them because I can't see the expected result after running. Help me find that mistake.

[Code]...

View 1 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

Dynamically Generated Table With Alternating Row Colors?

Aug 4, 2009

I'm using a javascript to alternate table rows and it works fine by table id, and on the first loop. This is all inside a conditional, in which the table tag is repeated.

On the second and subsequent loops, the alternating row color fails because there can only be one unique id call to a page. Right?

What's the script that will allow unlimited reiterations of tables with alternating row colors, using class?

View 4 Replies View Related

JQuery :: Alternating Bg Colors In A List Depending On Boolean Value

Apr 22, 2009

I have a list that looks like this:

<ul id="thisList">
<li class="this0">content</li>
<li class="this1">content</li>
<li class="this1">content</li>

[Code].....

View 4 Replies View Related

OnClick Event For Images

Dec 26, 2006

I am trying to set the onclick event for images through a function, but the
event is triggered as soon the page loads, then will not work when the image
is clicked. Can anyone suggest what is wrong?
It is happening in both IE6 and Firefox
---------------------------------------------------------------------------
window.onload = fnNewWindowLinks;

function fnNewWindowLinks() {
for (var intLinks=0; intLinks<document.links.length; intLinks++) {
if (document.links[intLinks].className == "picture") {
document.links[intLinks].onClick = alert("Clicked");
}
}
}
---------------------------------------------------------------------------

View 5 Replies View Related

Assaisning Onclick For Images?

Feb 13, 2010

I am currently building a memory game for an assignment. I guess you can figure out what it's supposed to do. Anyway i am having problems assigning onclick events for my images, as the way i've learned b4 doesn't work. The issue is this code snippet, everything else works or is in a working state at least;

[Code]...

View 1 Replies View Related

Onclick Swaps 2 Images?

Apr 22, 2011

I have been spending all morning trying different solutions. I'm trying to change two images ('bigpic' and 'desc') when someone clicks on a respective thumbnail. I have the swap working for 'bigpic' but cannot add the swap for 'desc' and get it to work. I used the Insert Image Object from Dreamweaver since I am not a Javascript coder and I've been looking through books and online and cannot find the answer. Here is the javascript code I have in the head:

<script type="text/javascript">
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

[Code]...

View 3 Replies View Related

Jquery :: Cart Image - Alternating Row Color Of Dropdown Part

Apr 6, 2011

I have an oscommerce web site with a cart in the header which shows/hides the content when you hover over it. What I'm trying to do is alternate the row color of the part that drops down when items have been added to the cart but I'm just not getting it right no matter what I try.

Code JavaScript:
$(function(){ // wait for the document to load
var globals = {
session_id:session_id,
cart_fetch_file:"cart_fetch.php?" + session_id ,
cart_fetch: false,
loading_image: '<center><img src="images/assets/loading.gif" align="middle" vspace="8" alt=""></center>',
cart_image_width: image_width,
cart_image_height: image_height,
cart_opacity: 1,
box_status: false,
timer: "",
speed: "fast",
text_cart_quantity: text_cart_quantity,
text_cart_subtotal: text_cart_subtotal, .....

View 2 Replies View Related

Hide All Images, And Show Certain Ones ONCLICk?

Jan 30, 2010

I'm new to the forums, so if i post anything wrong let me know. I'm trying to use links to hide all the images, and show just ones from a certain category. I've used the img name attribute to group them and tried to do a function that shows only one img.

<script language="javascript">
function showone(x) {
document.getElementByName('a').style.display='none';
document.getElementByName('b').style.display='none';
document.getElementByName('c').style.display='none';

[Code]...

except the links don't work like they should, and I can't figure out why. I'm an idiot with javascript, so if feel free to make fun of me, and if anyone knows how to get this simple function to work,

View 9 Replies View Related

Double Onclick + Event Images?

Jan 19, 2010

http:[url]............1) In the events.js-file where you write the longer text part for the tooltip, is it possible to include images somehow for each event within the end of the tooltip?I thinkt that would make the activities look a bit more interesting to read about.

2) When I click on any yellow event in the calendar, it changes the text to the right. Fine with that. But is it possible to use onclick as a double function?So that when I click on "START" (bottom left of the calendar) after having pressed any yellow event, it will not only take me back to the right month but also take me back to the start text?

View 1 Replies View Related

Toggling/Switching Between Multiple Images With OnClick

Apr 8, 2009

I have created a long list of items. For each item, there is 1 image. In my case, I use the same image each time.

I would like to use JS to allow users to check an item by clicking on it. Please note, I am not using radio buttons or any other forms.

This is my JS function:

It is triggered using this:

It works for each image. It switches to 2.png when a user clicks on each instance of that image. But how do you make sure it switches back to 1.png on the next click, and so on, effectively creating a switch for multiple instances of the same image?

View 2 Replies View Related

OnClick - HTML Drop Down Box To Work With Images Instead?

Apr 12, 2010

HTML drop down box to work with images instead?

[Code]....

What i want is just 3 images (representing the currency flag) I have tried just simply using the onclick="" but im guessing i will need to create a JS function?

View 9 Replies View Related

OnClick Slideshow - Array Of Images Not Sliding

Feb 17, 2011

I have an image on my page. And I want, when someone clicks on it, it must cycle through an array of images. However, I can't seem to get it to work.

HTML Code:
<div id="slide">
<h3>Some of my work</h3>
<img src="images/slide/slide1.jpg" width="650" height="300" alt="Slide" id="slideShow" onclick="processNext();" />
</div>

Code:
window.onload = initLinks();
window.onload = processNext();
var slidePics = new Array("images/slide/slide1.jpg","images/slide/slide2.jpg","images/slide/slide3.jpg","images/slide/slide4.jpg","images/slide/slide5.jpg","images/slide/slide6.jpg");
var thisPic = 0;
function initLinks(){
document.getElementById("slideShow").onclick = processNext;
}

function processNext(){
thisPic++;
if(thisPic == slidePix.length){
thisPic = 0;
}
document.getElementById("slideShow").src = slidePix[thisPic];
return false;
}

View 5 Replies View Related

OnClick Event Images Deliver A Variable To Another Page?

Sep 11, 2009

I have a html page with a lot of thumbnails. The idea is that when the user clicks on an image the onClick event is to display another detailed form and deliver to that form the name of the image in a variable. In the detailed php-form there is a query to MySQL to retrieve a record. The record will be retrieved by a Query based on the name of the picture. Apparently the PHP cannot do the job. I had an idea to make the thumbnail page as a form and to use use a hidden field with the thummnail name which should be carried on with the $_POST array through the submit button but i do not want to have a submit button. The more elegant way is just by clicking the picture the detailed page is opened and the variable is transferred where my php code can make use of the variable for the query. I have never used java before so you have to excuse for the lack of knowledge.

View 3 Replies View Related

Need To Simulate OnClick From Select Menu

May 19, 2006

I have a dropdown list:

<select name="select" class="mapMenu" onChange="JumpToIt(this)">
<option selected value="none">Select a Tool --</option>
<option value="javascript:onCreatePrintable()">Print Map</option>
<option value="javascript:onFindLatLong()">Find Lat/Long</option>
</select>

That calls a script:

<SCRIPT LANGUAGE="JavaScript">
<!--
function JumpToIt(list) {
var newPage = list.options[list.selectedIndex].value
if (newPage != "None") {
location.href=newPage
}
}
//-->
</SCRIPT>

Which in turn selects an option from the original dropdown.

Works fine except.....

The options in the select call scripts that open new browser windows,
and when this occurs popup blockers swing into action and block the new
window. When I originally had the javascript calls as plain links such
as [HREF="javascript:onCreatePrintable()"] the popup was not blocked
since it was obvious that user was clicking the link. Now that I'm
trying to save much needed space by putting these links into a
dropdown, the popup blockers are not recognizing the user selection....
I guess. I was thinking the javascript could somehow simulate an
onClick to alleviate the problem. Any suggestions?

View 1 Replies View Related

Creating An Onclick Slidedown Menu?

Oct 28, 2010

I would like to create a slidedown menu similar to the one that can be seen here..[URL]...

The main points are:submenu slides down when main nav item is clicked, not on hover submenu stays open until another top level menu item is clicked, which makes the first submenu slide closed and the new submenu slide open active items in top level menu and submenu are highlighted. when a page linked to from a submenu loads, it's submenu is visible.

I'm afraid when it comes to JS/jQuery, while I'm usually capable of modifying existing plugins to fit my needs like superfish etc, I'm not able to roll my own yet. Unfortunately I can't seem to find an existing plugin that basically does what I want on this occasion..

[Code]...

View 4 Replies View Related

Tab Menu Fails Using Images Not Text

Jan 11, 2011

here's the page... [URL] it uses a tabbed menu using the tutorial at [URL] the tutorial uses text in the <li>'s, but I need to use images problem is, clicking on the image does not trigger anything but clicking on the "cc" "t" and "f" text does

View 2 Replies View Related







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