i have 3 links... (eg. stomach, brain and heart). and also 3 images (stomach.gif, brin.gif and hear.gif) when i click stomach i want to display the image of stomach and hide the rest. ALSO there are another 2 links (view cross-section, and view inside) and images associated with this if stomach is selected, clicking the 'view corss-section' should display corss-section image of the stomach (together with the stomach image).....if brain is selected, clicking 'view corss-section' should display corss-section image of the brain..
I want a specific function to be available to multiple objects.In the script, if it says 'document.Form.Input.value' with 'Form' being the form name and 'Input' being a form element, how can I change this so that I can have two different forms with elements and the function will be able to work for both?
I have kind of a complicated setup, and I was hoping to bounce this off some one's head who's more experienced with JavaScript.Assuming I have the following HTML markup:
I basically have several buttons that are created dynamically via a db, so I can have 1 to 40 etc. now at the moment I give each one a unique id and a hover code in the loops. see below:loops goes here..
I was wondering if there is a way to simplify or clean up the code, since they are all doing the same thing and responding to the same event. This is just for refactoring reasons because my code is getting too long/messy.
I was wondering how you would list multiple variables after a equal ==? Example.... if ( pathname == schoolinformation, chaplainchatter) $('#button_newspress_archive,#button_tech_college,#button_parent_portal,#button_transition_portal,#button_6th_form,#button_connect,#button_vacancies,#button_vle_login').css('display', 'none'); $('#school_information_sub').css('display', 'block'); if ( pathname != schoolinformation, chaplainchatter) $('#school_information_sub').css('display', 'none');
Or even list multiple URL's within the variables? Example .... var schoolinformation = '/st-paul-s-website/school-information/school-news/headteachers-headlines', '/st-paul-s-website/school-information/school-news/chaplain-chatter-headlines';
Is it possible to assign multiple variables at once? For example:
var int1,int2,int3,int4,int5 = 0
I'm just wondering because I did this without thinking and my program never gave me an error and everything worked fine. Is it because these variables are set to 0 by default or what? If it does work, are there any other languages that this works in such as vbscript?
I have this code <script type="text/javascript"> jQuery(document).ready(function(){ $("select").click(function(){ alert($(this).attr('id')); }); }); </script> <FORM><select name="category" id="#link1"> <option value=1>1</option> <option value=2>2</option> </select></FORM> <FORM><select name="category" id="#link2"> <option value=1>1</option> <option value=2>2</option> </select></FORM> <FORM><select name="category" id="#link3"> <option value=1>1</option> <option value=2>2</option> </select></FORM> When I click on any of the select fields, I always get 3 subsequent alerts, each with the id of the clicked select field. What I would like is to have only 1 alert with the clicked select id, whenever I click it.
I have a set of functions that will transition/fade photos in and out as background images. Easy. But now I would like to run the same functions on a different html page with different photos (each different page represents a different JavaScript array).
I've been reading online on how jQuery methods can be called into functions. So my thought process is to create 2 methods (1 for the original images and the 2nd method for the other images).
So here is my base code which works... $.landingpage = function() {
/*Enable background image cycles on landing page*/ var images=new Array('/image01.jpg','/image02.jpg'); var nextimage=0;
I'm pretty new to Jquery but been using mootools for quite some time now... I just wonder, how could I assign function to jquery? In javascript, we do the regular : function Myclass() { //some code here } and call the Myclass by: Myclass();
In mootools: var Myclass = new Class({ //some code here }); And call the Myclass by: window.addEvent("domready", function() { new Myclass(); });
In Jquery, how would I do that? Is it okay to use the javscript function instead? Or is there a standard way of doing that in jquery? function Myclass() { //some code here } $(document).ready(function() { Myclass(); });
I would like to have page which uses a few xhr objects and automatically (after 30 seconds) starts the same few requests again It works for me well in IE7, IE8, but not IE6 (where is in browsing history chosen option "automatically" ). It works there only for first time and I can't set it for circular reloading. It looks like page is reloaded, but xhr objects are not doing their job ...only - as I wrote - for first time after page load.
Trying to create a date validation form; since most don't do what I need. So far it's doing ok; I'll admit I found a lot of the code on the web, but I wanted to add it where it would automaticly change the string entered (Example if a user did 3/5/2010, it would make it 03/05/2010). Well getting the month was easy, however I'm having trouble fixing the date. Here is the problem section. ValDate is called from the validation function.
[Code]...
Here I though i was being clever too but apparently I missed something.
I'm trying to create an ActiveXObject from the passed in parameter. I'm getting the following error 'Can Not assign to a function result.' How do I get around this?
<script lanaguage="javascript"> var PageXml = '<Doc><Node1/><Node2/></Doc>' function LoadXmlData(Source) { var XmlSrc = eval(Source);
eval('Source') = new ActiveXObject("Microsoft.XMLDOM");//ERROR: Can Not assign to a function result.
the situation: I'm building a web page, and the client wants to have three flash galleries on staggered timing (i.e., the first one loads and runs, 4 seconds later the second loads and runs, 4 seconds later, third one loads and runs).
I've been trying to figure out how to use Javascript to handle the initial delay between each object, and the best I can figure is to use an onLoad to start the first flash (Flash1), and then call out a function with setTimeout to start Flash2 4 seconds after Flash1 loads, and the same thing for Flash3. However, my attempts thus far have failed, and all three load up at the same time.
Must you use the keyword "new" whenever creating a new object? I was sure the answer to this was yes, but a friend was telling me in this example: var newDate = new Date(); alert(newDate); The word "new" is unnecessary and that the system date would be assigned to newDate regardless. Is this true for all objects? Some of the time? Never? I've always understood that "new" was necessary and never questioned it.
Is there a way in Javascript or Jquery to return an array of all objects underneath a certain point, ie. the mouse position. Basically, I have a series of images which link to various web pages but I have a large semi transparent image positioned over the top of the other images. I want to find the href of the background image that the mouse pointer clicks over.
I have a toggle animation which puts the area I want to show to the user in view, ones that animation has played I want to animate several other objects on the page. I have the code to animate one object by using the callback function in animate. But is it possible to animate several objects in the callback function?. this is the code I have so far
Can assign a new function to a built-in object in Firefox:
But IE and Opera don't have a MouseEvent or HTMLElement that can be set up in the same way. Can you do this in IE or Opera, or just Firefox, and maybe Webkit?