My problem is that every other turn I have to click either button twice to start the desired function. Say, I autoplay the images first and I want to shuffle them, I click shuffle and the autoplay stops working and I need to click shuffle again and then the shuffle runs. How can I make it clicked once and the function runs?
a.) specify two parameters for the changeYear function: today and holiday.
function changeYear(today)(holiday){
b.) in the first line of the above function, use the getFullYear() date method to extract the 4-digit value from the today variable and store the value in a variable named year.
first line
c.) in the second line; use the setFullYear() date method to set the full year of the holiday date object to the value of the year variable.
second line
d.) in the third line, use a conditional operator on the year variable. The test condition is whether the value of the holiday date object is less than the today date object. If it is, this means that the event has already passed in the current year and the value of the year variable should be increased by 1.
third line
e.) in the fourth line of the function, again set the full year value of the holiday date object to the value of the year variable.
i'm having the following problem, normaly i work with html css and php but for this to work i need to make a litle javascript function and i'm still kinda new to it. so here is my problem.i'm making a search field where someone has to select some radiobuttons.first it has a selection out of 4 items and then a selection out of like 20 but how do i get the value from the first function in the second?in this case i would like to have the following in function showStreek:
xmlhttp.open("GET","test3.php?l="+land,true); this line should look like: xmlhttp.open("GET","test3.php?k="+kleur"l="+land,true);
I have been having trouble with forms and functions. On my wife's site I have some forms and some of them have radio buttons. My current radio button checker is cumbersome and it is time for something more elegant (some of you will say if it isn't broke don't fix it )
The new code is below:
Code:
Basically I want to pass into the function radio button values 1 & 2 denoted by firstChoice and secondChoice (eventually I want to also pass in the form name but 1 step at a time).
The buttons can have the value (names?) of pattern, chalkboard or kit. It is for a shopping cart (Mal's E-commerce) and this is part of the JS validation. I am using onsubmit to call the function viz.
HTML Code:
Seems ok (to me at least) but when I try to get it to work it throws up an error of
Code:
It stops at that point but undoubtably chalkboard would throw up the same error if it continued.
How would I define the variables in my function? Are they strings, integers, who cares? Where would I define them? Global or local?
Is the problem a matter of syntax e.g. if I put ' ' or " " around them would that suffice?
I am trying to convert some of my javascripts into a class and am running into difficulties which i think are related to variable scope.
Basically I have a constructor function for a calendarInput class that takes 4 parameters, the first is a reference name/number for this input. I also have some functions for importing my PHP classes into Javascript using AJAX (properties only. still trying to get methods working but that's another story!). The relevant function is called call_object_method(classname, methodname, createparams, methodparams, post, callbackfunction). This creates an instance of the specified PHP class using the parameters in createparams. It then calls the specified method using the parameters in methodparams. The result is passed back to the javascript function specified in the callbackfunction parameter (ie the value of xmlhttp.onreadystatechange is set to callbackfunction before xmlhttp.send() is called)
The function i am trying to fix is called show (x,y) which creates the html for the calendarInput and displays it at co-ordinates x, y.
this.showcallback = function() { alert(this); <!--//code to create html//--> }
}
I know i've cut out most of the innards of this. This is because I have already tested these functions and had the calendarInput working outside of a class, hence am pretty sure that this is ok (plus it runs to almost 1000 lines these days!!). My problem is that when I call the show method, the alert on the first line of the callback function returns the function showcallback instead of (as i was expecting) the instance of the calendarInput object. Whilst this kinda makes sense I can't figure out how to reference the Object instead. I have tried 'this.parent' but this returned undefined. I have tried changing the way i reference the callback function (ie the final parameter of call_object_method) but no joy.
So in the Tutorials:How jQuery Works, I've noticed that you can make a call to .get like this : $.get('myhtmlpage.html', myCallBack);
I've also noticed that in the docs jQuery.get() is described as jQuery.get( url, [data,] [success(data, textStatus, jqXHR),] [dataType] ). My question is, in the above example, the callback function is the second argument, whereas in the docs the second argument is data, and the third is the callback function. How does this work? Also, what does it mean when the arguments are laid out in an array-like fashion with commas in the square brackets? i.e. arg1, [arg2,]...
I've recently started developing javascript using jQuery and so far I'm really enjoying it.Being a professional programmer (mainly C, C++, java and python) there is one thing that's been puzzling me regarding variable scope and unnamed function declarations. Let me exemplify:
------------------------ var sum = 0; $(xmlobj).find("item").each(function(){
Is there any way we can watch variable values inside javascript functions while running through the debugger. I am using javascript along with ASP.net on Visual studio 2010.
I think the last thing people seem to learn about in JavaScript when they're not coming from other programming languages is variable scope. Some even get all the way into AJAX without having learned about scope, and this is a time when it's really needed. Although the scope of JavaScript variables is non-complex by nature, it's something we should all get a full understanding for before we move too far. Section 1: What is "scope"? Section 2: The "var" keyword Section 3: The "this" keyword Section 4: Closures or "Anonymous functions and self-invoking closures
The 'array' variable contains strings representing the id's of different elements. If the for loop above were to finish iterating, would all the links in all three elements call the click function (that displays an alert message), or would only the last element ("element3") have the click function? For me, the latter seems to be the case unless if I'm doing something wrong, but I would like clarifications and, if possible, alternative solutions as to how I can achieve the former result.
Situation:I have a very long page divided into many sections vertical-wise marked by bookmarks, say pageX.html#s1 to s10. I need to show the section inside an iframe (iFrame1) on the mainpage (mainpage.html). I am thinking of having 4 buttons, sitting on the mainpage, to help navigate between these sections on pageX, namely NEXT, PREVIOUS, TOP, END.condition of the frame, fixed width/height, no scroll, no border.Very new to javascript but need this code to make a page work for BIZ.
I am using Ben Alman's JQuery resize plugin in order to obtain the varying computed width of an element when the window is resized (the element in question is a page wrapper that exhibits the expand-to-fit behavior of a block box, and it's computed width is obviously influenced by the resizing of the window. Essentially, what I need to be able to do, is to reference a variable that is defined in a .resize() function ('width_page') in a seperate .each() function.
[Code]...
I now understand that variables can't cross boundaries like in the example above, which leaves me a little stuck. I also understand that this is specific to the context of the .resize() function, and that it can't be taken out of it without using an element selector. Is there some way I can call the .resize() function in my .each() function?
I have written a number of functions designed to return frequency data on 1000 randomly chosen numbers using different math functions for the rounding. I would like to include all of these functions within the wrapper of another function so that only one call is needed to get returns from all of the 'inner' functions. However, while each of the functions works in isolation, the moment I wrap them in another function they stop working. :confused:
The following code is one of the functions 'frequencyWrapperOne' that has been wrapped in the function 'testWrapper'. A call to testWrapper does nothing.
function testWrapper() { function frequencyWrapperOne() {
I have several form in my site, that validate on onsubmit.I call all the validation functions from a file call functions.js.Here is a sample of the code that is working:
I am trying to declare a variable inside a function and use it later on in my code... but it just already returns white space... i.e. not variable value. I am setting it within this function:
function show_video1(){ document.getElementById('video1').style.display="block"; var video1Name = "Education World News (Part 1)"; document.getElementById('video2').style.display="none"; document.getElementById('video3').style.display="none"; document.getElementById('video4').style.display="none"; [Code]...
and trying to call it later on with this: <script type="text/javascript">document.write(video1Name)</script> It might be worth noting that each one of my 11 videos will hace a different name.
Ok, so I've built a member search using ajax to change the results each time a filter is changed. It works great, except one minor issue that I'm struggling with...I just can't specify dynamically in the parent file that linkclass$id opens linkclasscontent$id as I don't know of any way to pass that $id variable back over to the parent.
i'm not really sure how to explain this, since I know nothing about javascript, so i'll try and illustrate by the use of php (hope it makes sence)
I have a set of different links, like:
<a href="link.com?page=text1">text 1</a> <a href="link.com?page=text2">text 2</a> <a href="link.com?page=text3">text 3</a> etc, where page is dynamic and can be anything I chose..
Another place in the same document, I echo out what the page variable is, like:
echo "$page"; so when clicking "text 1" the echo will output what i've defined the page to be, in this case "text1" ..
So I want to be able to click the links and change the output of the echo all depending on what i've defined in the link - without refreshing the page!
does anybody know how I am able to control Flash Movies from html or JavaScript? For example, I want a movie go to a specific frame each time I open the html file where it is embedded.
I have a form frm1 . The form is generated by a "control" that is placed on the page - I have no access to the source to modify the controls. I can access other hidden controls within it by referencing:
ocontainer.frm1.txt1.value;
I would like to insert my own hidden control that can be posted back to to my page so I can do something with it. How can I do this from clientside at runtime?