Assigning Parameters For Functions, And Looping
Jun 27, 2006
There is a frame, the top part of the frame contains a button. On clicking the button, the bottom part of the frame changes colors, which are contained in an array present in the head of the code.
For some reason, this is not working, perhaps something wrong with the way I have assigned the parameters. Code:
View 3 Replies
ADVERTISEMENT
Dec 26, 2010
I have a problem with a function i created. I want an image to move from a to b and then start from a again. Without parameters this works really fine, but now that I have got more images I use parameters but I have no clue how to call the funtion again.
[Code]...
I tried to replace show(100,flo) with show(100,flo(zahl,r_g)) but then the divs only move from a to b but even will not come back to a again. I think the solution should be pretty simple but i cant figure it out.
View 4 Replies
View Related
Jul 20, 2005
I am creating a tool to merge xml files using xslt usin
Javascript/HTML.
Basically the user browses (browse button) to where there xml file
are, then browses to where their xslt file (to perform an operation
is. Then they click an "apply" button and the result is output in
frame below.
My problem:
I have the tool working fine when I only have one input xml file (whic
is no good in a merge tool!!) but when I modify the code and ad
another xml field, the apply button will not work for two fields!
I think I haven't assigned the functions correctly to the xm
fields/apply button. Heres some of the code I suspect is wrong, but i
not sure where?? Code:
View 3 Replies
View Related
Jun 10, 2011
Say I have the following code:
And I want this code to print 21.
How should I implement the function Curry?
I tried intuitively:
But it didn't work.
View 6 Replies
View Related
Apr 20, 2010
I am working on this simple calculator that passes values from one function to another via paramters. I have used alert() to find what is being recieved, so far nothing. code...
View 2 Replies
View Related
May 20, 2011
Ok so the following code works.
function myFunction(myName)
{
alert("You are "+myName);
}
callFunction = "myFunction";
parameter = "Joe";
[Code]...
View 3 Replies
View Related
Jul 27, 2011
I totally understand that in order to learn javascript I need to know how functions work, I understand the basics of passing in parameters and then calling the function with the values to maybe add something together etc I ve read countless articles about functions as well as books etc but I just dont get how they are used and when they should be used etc, the more advanced functions that have maybe 4 parameters and are doing different calculations and returning various values that get fired back into the script just totally confuses me.
What I would like to know is first of all how can I overcome this confusion and also any words of wisdom you may have. I will also add that I have no prior programming experience and have spent the last 2 months frequently hitting my head off a brick wall as I just cant understand javascript.
View 1 Replies
View Related
Aug 15, 2011
I am creating a website, and I have javascript function that will play a video playlist by passing it a playlist ID. I want to be able to share a url that points to my website and also calls a javascript function, like: [URL] If someone clicks/enters that url, they redirect to my website and the getPlaylist(id) function is called. Is there a way I can do this?
View 1 Replies
View Related
Jul 23, 2005
var gE = function(s){return document.getElementById(s);};
var foo = gE("foo");
work, while
var gE = document.getElementById;
var foo = gE("foo");
does not?
View 4 Replies
View Related
Nov 23, 2005
When i assign some css properties should i allways use the postfix like
measurment units (so use: 150px instead of only 150).
View 5 Replies
View Related
Jul 20, 2005
Any neat way to copy a snapshot of one array to another?
A normal assignment results in the second array pointing to the first,
with changes to either array affecting both.
As a trivial example:
var a=new Array();
a[0]="zero";
var b=a;
b[1]="one";
alert("a="+a.join("*")+String.fromCharCode(10)+"b="+b.join("*"));
.... this results in a and b being identical two-element arrays.
Is there any easy way to set array (b) to be a copy of (a) BY VALUE -
ie using the contents of (a) as they were at the moment of assignment,
but leaving the two arrays separate so that subsequent changes to one
array does not affect the other?
View 3 Replies
View Related
Dec 29, 2009
I have an index.htm page ready. I want to be able to put in javascript code into the HTML coding that will write the ip address of the actual server that is hosting the website into a hidden text box. Then I want to insert this ip address into a hyperlink in the original index.htm to link to another html page (this will be a SSL secure page instead i.e. [URL].Also vice versa. (With SSL index.htm page have code that writes ip into hidden text box then hyperlink to the original http index page)
View 7 Replies
View Related
Jul 12, 2004
I have the html contents from an iframe stored in a mysql data record. I now want to load that back into the iframe. I can assign the php var to a js var using PHP Code:
var scontent='<? echo ($html) ?>'
but the string has been saved to the db with newline chars in it and is causing a js error because it is being interpreted as an un-terminated string:
var scontent='<P>This is a test</P>
<P><FONT color=#ff0000>Red</FONT></P>
<P><FONT color=#ff0000><STRONG>Bold</STRONG> <U>Underline</U> <EM>Italic</EM></FONT></P>
<P><FONT color=#0000ff>Blue</FONT></P>'
I have tried stripping the newline chars out using php: PHP Code:
var scontent='<? echo (str_replace("
","",$html)) ?>'
It didn't work. I was wondering if there was a way of assigning multiple lines to a js var. any ideas?
View 4 Replies
View Related
Apr 25, 2010
I'm trying to create a function that will return the value of responseXML so I can assign a variable to it.
Code:
ajax.downloadXml = function (url)
{
var XMLHttpRequestObject = false;
[code]....
Stepping through the function, the onreadystatechange seems to never be executed, so nothing is returned. There's probably just a fundamental I'm messing up on.
View 5 Replies
View Related
Jun 17, 2009
3-level dropdown box: [URL]. Now in this dropdown menu if you select:
Category > Cars
Sub category Cars for Sale
Sub Sub Category Ibiza
What I want to do is two things:
1)Place a value on all the Sub Sub Category(ies) so for example the value of Ibiza I want to = 55
2)Then Grab that value? How would I get that value and grab it from POST?
View 1 Replies
View Related
Jun 19, 2009
I am barely familiar with javascript. I have this html code with an embedded iframe. The html file in the iframe refreshes every once in a while. That is fine. However, in IE, there is this annoying click with every refresh. I googled a bit and saw a few solutions. Seem to me that if I fetched the contents of the HTML file (AJAX call) and assigned it to existing document.
1. How do I assign an entire document in JS?
2. If I did this would this prevent the clicks?
View 4 Replies
View Related
Jan 27, 2009
I have a situation where I'm trying to assign a value to an elements innerHTML. When I do this, the value is assigned, but it causes havoc on subsequent javascript calls.I realize this is kind of vague but I'm at my wits end on what to do. I've tried assigning the innerHTML value "NA", just plain text, and it has the same effect.Without being too confusing, I have a table of data inside a <div> where the user can navigate up/down by pressing the <enter> key, pg up/pg dn and arrow up/arrow down. When they move from record to record, I'm highlighting the new row and "de-highlighting" the old row. The row has many fields but only one fill in field which is where the user enters the quantity of the item to be ordered. This is on a local network using the Firefox browser.
Without the above line, all is well. When I use the above line, it messes up the highlighting of the row but also makes the fill-in field "appear" disabled. What I mean by that is when you type a number, you don't see the value change (even though the field has focus and the value is selected) but once you leave that line, the value you typed then appears in the fill in. Normally the value will change as you type a new value.
View 4 Replies
View Related
Nov 7, 2009
I'm running a PHP script to check whether the user is logged in or not. If the user is not logged in they are redirected to the login.php page.What I would like to do is redirect them to the PHP page but also grab the URL they were previously on and assign it to a hidden field in the login.php so that I can redirect them back to the page they were on while keeping the URL bar clean.Problem, I know that PHP cannot recognize a hash [URL] so I would need to grab the url through javascript instead of PHP.
View 3 Replies
View Related
Sep 29, 2011
I am currently putting together a trivia game and I have stored several items in an array for example the questions, and the answers, points value... etc.
but my dilemma is I have to assign an "id" to the elements in the the array so i can use the function getElementById() to call the information. I do not have a clue how to do this.
*** also the second issue is my array is showing an error as UNDEFINED BUT i have declared it in "var triviaArray"
this is my array:
var triviaArray = new Array [
triviaArray["What's the capitol of Canada?","TORONTO","VANCOUVER","OTTAWA","QUEBEC",10,"choice3"],
triviaArray["How old was Michael Jackson when he died?","35 yrs","50 yrs","40
[Code]....
View 11 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
Jul 23, 2005
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>test</title>
</head>
<body>
<script type="text/javascript">
try{
var foo=document.writeln;
foo( 'Hello, world!' );
}
catch( e ) {
alert( e );
}
</script>
</body></html>
IE has no problem with this, but Firefox throws an exception - "Illegal operation on WrappedNative prototype object". Is it within its rights to do so?
View 2 Replies
View Related
Oct 17, 2005
I have a function whose parameter is a reference the element that called it:
function someFunction(el)
{
...
}
The function is assigned to the onclick event of some elements in the
HTML source:
<input ... onclick="someFunction(this);" ...>
and dynamically to others:
elRef.onclick = someFunction;
When someFunction() is called from the statically-assigned onclick, el
is a reference to the element. But when it has been added dynamically,
el will be either undefined (IE) or 'event' (Mozilla et al).
To assign the right value to el, I can test if el exists and if it does,
whether its constructor is some type of HTML element or 'Event'. But IE
doesn't support the constructor property for elements (or have I just
not found it yet?) nor does it understand 'Event' the way Mozilla does. Code:
View 4 Replies
View Related
Mar 7, 2006
Basically we are trying to simulate the tab key when the
down arrow key is pressed. (we know there are other way
to control focus flow but we use a lot of dynamic jsp fields,
that will make the flow control a nightmare, we just want
basic tabbing from the arrow key)
1)We are able to capture a onkeydown event and reasign it with another
key value with no problem within an html document without a form.
example:
var ieKey = event.keyCode;
if (ieKey == 40) {
event.keyCode = 9;
}
however as soon as we insert a form tag in the document, this stops
functioning. The asignment seems to be fine as an alert clearly shows, but the
instruction seems to be ignored. Code:
View 5 Replies
View Related
May 8, 2006
i have an html text box (which is part of a from) to which a value will
be entered by a user. i need to assign this value that has been entered
to a JS variable.
would the sxcripting be as simple as:
var nameOfVar;
nameOfVar = textBoxName;
View 3 Replies
View Related
Nov 30, 2010
I'm not even sure if that's the issue here, but I've isolated it and all the other code is working, so what I'm thinking is that if this:
Works here [url] to hide/show a line,
Then this:
Should work here [url] to show/hide lines and arrows
The difference of course being that the first code uses poly_num, which is taken directly from the var poly_num = gpolys.length - 1; code (because it only needs to show/hide one line at a time) whereas the second uses the xml attribute "category" from here var category = lines[a].getAttribute("category"); because it's attempting to hide and show a line with arrows on it (the arrows being in the pts array), both of which share the category attribute.
It's not throwing up any major errors, but it's not working, either...
View 1 Replies
View Related