Functions - De-cyphered - Something Subtle In The Background
Apr 15, 2011
I'm trying to unravel / understand / re-code a website i've inherited. I can just about work my way around the html, but the javascript is proving to be a bit more taxing!
Anyway - the pages all have the following javascript functions coded into the head. I'm assuming a function is only activated if it's referenced from the body. I can't find any reference to these functions in the body and... if i remove them the pages seem to work ok - but of course they may be doing something subtle in the background that i'm unaware of so...what these functions are likely to be doing, and if they are actually useful/needed?
View 2 Replies
ADVERTISEMENT
Mar 3, 2007
(A) Some of us in the UK will have been watching with amusement what
seems to be happening in the USA and its Northern Sidekick with regard
to the change in DST rules.
I've discovered that the change will also be happening in the Bahamas
(Commonwealth), Bermuda and Turks & Caicos (British Overseas
Territories) - I wonder whether anyone told Her Majesty?
(B) Date Validation - ISTM that using D = new Date(y, m', d) then
checking getMonth and getDate may well fail on one or two days of the
year for users in the Azores and in South-East Greenland.
Time validation by similar means could occasionally fail likewise
anywhere that has Summer Time - but probably not, depending on code.
(C) US+ DST changes can be important for anything hard-coded for the
afflicted areas, and for machines there with non-updated OS data.
View 4 Replies
View Related
Mar 22, 2010
I have a quick question for all you skilled developers -- I'm new to the forum, intermediate with JS/jQ.
How simple would it be to implement a subtle and quick slide-in of the page content using jQuery (only that once for the home page onload).
For a reference check out this site example. I wanted to do something nice like this WITHOUT FLASH =)
View 4 Replies
View Related
Jun 27, 2010
I'm using LavaLamp [url] for the main navigation on a site I'm building, for a subtle animated effect.
The site itself is a single-page portfolio site with 3 sections organized vertically, "Home," "About," and "Work."
The problem I'm having is that the clicked navigation does not return to its original position on each panel if I double back on it.
For example, if I'm on the Home panel, and I want to get to About, I'll want to select "About." The LavaLamp animation will ease over to the "About" link on hover, and I'll click it, then the page will scroll to the About panel, where "About" in the navigation is being shown as selected (LavaLamp has a "current" class you can apply to whatever you want to start off as being selected)...
And that's great, BUT, say I want to get back to the Home panel. I click "Home" in the nav, and I'm transported back to the Home panel - but when I was there before, I'd selected "About", and since it's all on the same page, the link is focused on "About," even though I'm on the Home panel. Make sense?
I'm not good enough at JS or jQuery to figure out how to fix this. I think what I want to happen is for every link on each panel to STAY where it was originally assigned ("Home" link will stay on Home, "About" link will stay on About, etc.), but animate on hover only.
Is there a way to write something into the LavaLamp JS to make it so the animation works only on hover, and not on active, focus, or visited?
Here's the code, can't provide a demo page, I don't have anywhere to upload it at the moment...
index.htm with an example of what each panel looks like:
jquery.lavalamp.js:
And last but not least, the LavaLamp CSS:
Forgot to add the page js:
EDITED ALSO TO ADD: Could it have something to do with this:
View 4 Replies
View Related
Sep 2, 2011
I have been trying to get better at my javascript as of late and there is this one particular color fading technique I have found that I am having trouble dissecting. The following code appears to be how they are making a rollover go from a dark gray to a subtle light gray with a nice fade but I can't exactly tell whats going on from the code. Is it just telling it to add a rgb point in so many seconds?
colorInit=
true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],0),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],0),255),0)+")"}});
View 1 Replies
View Related
Apr 29, 2011
I am trying to change my sites background color. The color changes but it doesn't go back to the first image anymore. does anybody know what the problem could be?
jQuery Code:
HTML Code:
View 1 Replies
View Related
Aug 20, 2009
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()
{
[Code]....
View 7 Replies
View Related
Apr 23, 2011
$(something).split(something),this is a function with a function as a property for that function.
View 8 Replies
View Related
May 14, 2009
I'm putting together a portfolio site and I'd like to use high-res images that take up most of the screen to show different works. There
would be a menu bar with links to each work, where a click on that work's link would change the background by doing a standard "dissolve"
effect.I have seen many different plugins for "rotating" images and changing background colors at the click of a button. Is there a method
specifically for this purpose? As an alternative to altering the background-image of the body itself,I would be willing to use a properly sized div (or div's) to achieve this effect.
View 5 Replies
View Related
Aug 24, 2010
provide javascript to create something like the image below: Things I can't workout are:
1. top and bottom background colors as the above image
2. add two text
3. border color same as top background color
[Code]....
View 1 Replies
View Related
Jan 27, 2011
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:
<form name="contact" action="contact-insert.php method="post" onSubmit="return checkform()">
<label class='SubHeadlbl' for='TextField1'><?php echo IDS_EFORMNAME?><br></label>
<input type='text' name='dfname' class='text_field' id='dfname1' size='70' maxlength='40'/>
</form>
all the other forms are not working. all have the same structure:
<form name="frm1000" action="frm1000-insert.php method="post" onSubmit="return checkform1000()">
<label class='SubHeadlbl' for='TextField1'><?php echo IDS_EFORMNAME?><br></label>
<input type='text' name='dfname' class='text_field' id='dfname1000' size='46' maxlength='40'/>
</form>
I don't know what is happening only one for work all the others don't.
View 10 Replies
View Related
Jul 28, 2011
I need to have three text boxes, user will enter a number in each box.Then i have four buttons, add, subtract, divide and multiply.When i click on each button, the numbers in the first two text boxes should match the answer in the third text box.ex. (first box has a 4, second box has a 4, and the third box has an 8. if i click the add button, i should get a "correct" answer in the div below with a green background and if i hit the multiply button the div should say "wrong" with a red background.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>[code].....
View 3 Replies
View Related
Jun 1, 2010
I think my brain would have exploded otherwize. Some of the problems have been simple misspellings, but when you have been staring at the same thing for hours it can sorta slip by.Bascially Im not sure if Im using the function command properly. When Submit Details is click it should validate the form and then when Calculate is pressed calculate the form (obviously).I think maybe my var Array table is wrong? And the way the functions are set out doesnt seem it sit right.
View 10 Replies
View Related
May 1, 2006
Define the function dollarToEuro, which consumes a number of New Zealand dollars and produces the Euro equivalent. The current exchange rate is approximately one New Zealand Dollar to fifty five Euro pence. Code the function in JavaScript. Prompt the user for an amount in New Zealand dollars and display the result.
So far i have done this coding :-
var nzd = Number(prompt("Enter The Amount Of New Zealand Dollars", "10"));
function dollarToEuro(nzdollar)
{
return (50/nzd)
}
document.write(nzd, "NZD =", dollarToEuro, "Euros");
It is not working.
View 3 Replies
View Related
Aug 2, 2002
How do you handle two functions? For example:
if I have two separate scripts, one that opens a popup window onclick and one that does a tool tip onmouseover, how do I tie them together inline, at the link? And i can put them in the same <script> tags in the head, right?
View 2 Replies
View Related
Jul 23, 2005
How do I "merge" the two functions below - checkFromDate() and
checkToDate() - so that I only have one function. I want to do the same
validation in both text fields, but only have one function that does all
the validation.
<html>
<head>
<script language="JavaScript">
function checkFromDate() {
var ToFrom = document.form.txtFromDate.value
// Do some other validation...
}
function checkToDate() {
var ToDate = document.form.txtToDate.value
// Do same validation as above...
}
</script>
</head>
<body>
Start Date : <input type="text" name="txtFromDate"
onBlur="checkFromDate()"> yyyy/mm/dd <br>
End Date : <input type="text" name="txtToDate" onBlur="checkToDate()">
yyyy/mm/dd
</body>
</html>
View 3 Replies
View Related
Jul 23, 2005
I am learning HTML for the first time taking a self teaching class
though my local Community College. Normally this college rocks and has
some of the best resources and down to earth teachers that pick books
that acutally help folks.
Well they failed and my book take more logic jumps that Stephen
Hawkins! :D
So my ultimate question is as follows:
How do I created a function with the following information provided:
Create a fucntion named Mquote that contains the single parameter,
Qnum.
My apologies for such little information. I am sure its my oversight
that I am unable to locate the answer to my question.
What I am looking for is the base layout for noob java functions.
View 7 Replies
View Related
Oct 25, 2005
I want a function to take another function as a parameter, and execute it as a line of code. I put a simplified example below, just to illustrate the idea. Does anyone know the syntax to do this, or is there perhaps a better approach entirely?
// EXAMPLE
doSomething(5, 10, functionA, functionB);
function doSomething(x, y, myFunctionA, myFunctionB) {
if (x > y) {
myFunctionA();
} else {
myFunctionB();
}
}
function functionA() {
// some code
}
function functionB() {
// some code
}
View 12 Replies
View Related
Jan 23, 2006
When I click on the "Check All" checkbox, it correctly checks all of the boxes in my form, but I would like each checkbox to also call hideLayer2 function just as what would occur if the user checked the boxes individually. Is there a way to call the hideLayer2 function and pass the correct whichLayer and the_box parameters within the DoToAll function? Maybe there is an easier way?
Code:
View 1 Replies
View Related
Jan 18, 2007
Is it possible to merge two functions like these?
<script type="text/javascript">
function showdiv(pass) {
setTimeout('showdiv2("'+pass+'")', 750);
}
function showdiv2(pass) {
var divs = document.getElementsByTagName('div');
for(i=0;i<divs.length;i++){
if(divs[i].id.match(pass)){
if (document.getElementById)
divs[i].style.visibility="visible";
}
else {
if (document.getElementById)
divs[i].style.visibility="hidden";
}}}
</script>
View 10 Replies
View Related
Jul 20, 2005
looking for a way to pass an array to a function.
====================================
<script>
function myfunction(arrayname)
{
document.write("blablabla"+ arrayname[1] +"blablabla");
}
</script>
<html stuff>
<script>
arrayname = new Array("what", "is", "wrong");
myfunction(arrayname);
</script>
====================================
View 1 Replies
View Related
Jan 30, 2010
I basically have 2 "if" statements. How would i go about combining them?
function validate_form(thisform)
{
with (thisform)
[code]....
View 6 Replies
View Related
Oct 26, 2011
I thought about following code snippet code...
Has anyone an idea, if my thoughts on that are correct oder if this behaviour could be a problem?
And is there probably a better way to combine functions, so that all functions would be in one column?
View 2 Replies
View Related
Nov 2, 2011
Hello, I have a very large function that activates on one click. It does many individual events that modify my site. They all work seperately but when I put them in a single function they all break. Is there a way, order or priority for putting large things of code in functions?
I tried doing {} blocks but it didn't help.
View 4 Replies
View Related
Mar 18, 2007
How can a function be written so that it is reusable within the same form? eg, I wish to place another select menu and its own result span <span="mySpan2"> in the following code (eg. mySelect2, mySpan2) - whichever select menu is chosen displays its own result within its own span: Code:
View 4 Replies
View Related
Mar 20, 2007
Can anyone point me to a set of statistical probability functions that will give me (say) the probability for a t-test, an F-test or a X2 test. I did find some in the wild on the net, but I am unsure of the legitimacy of using them.
View 1 Replies
View Related