Writing Function Output Values?
Jan 20, 2009
I've got a glitch somewhere and it's not obvious to me. Maybe someone can spot it.My problem is that the functions seem to return values but don't display them like they should. I'm testing returned values with a function called sayvalue(item). But when I test "DelTimeCode" the function returns "[Object]". I don't understand. I get returned values from DelTime and DelTitle.My approach is to select a radio button option, return a delivery title and a delivery price from the appropriate functions then write the information. I think I'm close. Any suggestions or observations of an error in my code?I have the following VARIABLES and FUNCTIONS:
<head>
var AmtSV;
var DelTimeCode="";
[code]....
View 6 Replies
ADVERTISEMENT
Nov 20, 2003
Write i have an array, "company" firstly how can i write this to a table, cells? ive been told very quickly. if a table cell has an ID like
<td>ID=firstcompany</td>
using something like
document.all.firstcompany.innerhtml
will be able to display the result somehow into the required cell.
CAN any one advise on how to do this?
and one more little question? HOW has my friend some how? protected his source from being seen online?
View 14 Replies
View Related
Jul 23, 2005
i can't figure this one out. from a main window i am opening another
window with a form in it. this form has an inputbox. from the main
window i want to write a value into this inputbox. so i need the handle
from the child window and write the value into this form.
i tried using:
var chWindow=window.open('form_with_input.htm');
var chForm=chWindow.document.forms[0];
chForm.name_of_element.value='test' //didn't work.
chForm.id_of_element.value='test' //didn't work.
both didn't work... can somebody help?
is it even possible what i am trying to do?
View 2 Replies
View Related
Feb 26, 2011
Just started using Arrays and i'm not getting the hand of it at all.
I'm needed to output to screen 2 values that are the same.
I have 12 months.. and 12 figures and i want to print out the maximum for the year.. and there happens to be 2.. The code i am using at present only prints one...
View 1 Replies
View Related
Apr 29, 2009
I have two drop down menus. I want two values to be added based on what they picked and then outputted to a text field to show a grand total in a dollar amount.
This is what I have:
Code:
Code:
Note I haven't did any type of code for the 2nd drop down menu just in case anybody says I don't see anything. I was working on trying to get started in the right direction.
View 1 Replies
View Related
May 31, 2009
I am "writing" a javascript function to my page with php:
<html>
<head>
<title>Just about everything</title>
[code]....
View 4 Replies
View Related
Jun 21, 2010
I want to use document.write to output the values of an array. If the array is too long, it totally ignores the width of the container div. How do I get the values to word-wrap when they get to the end of the container?
I've searched on this forum, and also googled for the answer but can't find a solution. I'm still fairly new to Javascript.
View 4 Replies
View Related
Jul 20, 2007
I'm not that familiar with javascript, and I am trying to write a
toFixed function.
The function takes two arguments, the number and the number of decimal
places we're interested in.
If the number of decimal places is negative, it's interpreted as the
number of significant digits.
Thus:
toFix(12345.6789,2) -12345.67
toFix(12345.6789,0) -12345
toFix(12345.6789,-2) -12000
I've hacked up a solution that so far works on all tested browsers for
the first 2 cases.
It's the last one I'm having trouble with... How do I get only the
significant digits?
It has to work for all of the following cases:
toFix(12345.6789,-2) -12000
toFix(12345.6789,-5) -12345
toFix(12345.6789,-7) -12345.67
View 2 Replies
View Related
Jun 12, 2011
I'm sure a Google search could answer this, but I don't know what it's called, haha. Dot sytax maybe?chain methodsHow do I write a function that can be called like this:
$('p').myFunction().val('the new value');
I played around, tried this:
function myFunction() {
$(this).css({'color': 'red'});
}
[code]....
View 4 Replies
View Related
Jan 13, 2009
I've been using the document.write function to loop through some xml and print the data within a HTMl table. I thought it would be useful to add a hyperlink to the table row, so I thought the best way to do this would to create a function (called popup), which takes an id as a parameter.
The problem with this, is that when writeing using the onClick, the speech marks seem to all get messed up.
Code:
onclick='popup('"+mailID+"')'
I'm 99% sure it's just the speech marks, i'm just not sure of the right combination, and it's doing my head in
If someone could even point me in the right direction, even the proper name as to what this is called would be great, as googleing it is proving to be a nightmare!
Here's the whole section of code if it's more useful:
Code:
var mailID = x[i].getElementsByTagName("mailid")[0].childNodes[0].nodeValue;
if (r == "unread") { //email is unread
document.write("<tr onclick='popup('"+mailID+"')' title='test'>"); } else { //else is read, so add colour
[Code]....
View 4 Replies
View Related
Apr 7, 2007
What is the purpose of writing a function inside parentheses?
PHP Code:
(function()
{
var myvar = xxx;
// my function code here....
}
)()
View 8 Replies
View Related
Sep 16, 2010
Here's a simplified version of the function that's giving me trouble:
Code:
function saveArray(w){
var arr="['z',[";
[code]....
View 5 Replies
View Related
May 11, 2011
If you specify arguments when writing a function should you still declare the argument variable inside the function?
example:
Code:
or
Code:
View 8 Replies
View Related
Aug 8, 2011
For example I have a link that I want to when I click on it, It writes some words after the link. I have written a code but it does not work as I want and it clears all the page and writes the words. I don't want to clear the page and write just words, I want to add words after the link.
Here is my code:
HTML Code:
<script type="text/javascript">
function a() {document.writeln('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');}
</script>
<a name="aaa" href="javascript:void()" onclick="a()">Click on me!</a>
View 1 Replies
View Related
Sep 28, 2009
Is there a way to write a custom tweening function, preferably with easing, without the use of the build in animate() function?In Javascript, it's possible to do this with an interval, but I haven't been successful in finding something similar for jquery
View 1 Replies
View Related
Oct 29, 2009
I'm trying to return all the permutations of a given string, so I wrote the following recursive function:
The problem is, I'm not getting all the permutations, and I don't know why.
For example, if string="bindle", the output I get is:
And then the function stops.
View 4 Replies
View Related
Jul 30, 2010
How would you go about writing a function that returns a string that outputs a branched bulleted list using <ul> and <li> tags of all the html elements in a page? The html elements don't all have id's or names, so I cannot reference them directly. I would like to do it recursively so that I can grab all the elements, not just those two or three levels deep.
[Code]...
View 3 Replies
View Related
Aug 14, 2011
How to take the numerical output from a function, and display it in an id—as in:
function Ran() {
var r = Math.random();
if (r < 0.5) return 0; else return 1;
// export 'return' to <span id="#myid">
[Code]....
View 4 Replies
View Related
Nov 3, 2010
I'm working on a project in which I parse the XML and I get the element names.
So far everything is ok.
Also, I would get a variable increment that I create in the function and I want to find out of it.
Unfortunately, I can not recover.
Here is an example of my script:
// start
// "i" is my increment variable
var i = 0;
$(this).find('foo').each(function(i){ // run correctly x time
i = i++;
[Code]....
How do I find my variable "i" to the output of my loop?
View 2 Replies
View Related
Feb 21, 2010
I am trying to taking this embedded script
Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var strDay;
if ((now.getDate() == 1) || (now.getDate() != 11) && (now.getDate() % 10 == 1)) // Correction for 11th and 1st/21st/31st
strDay = "st ";
else if ((now.getDate() == 2) || (now.getDate() != 12) && (now.getDate() % 10 == 2)) // Correction for 12th and 2nd/22nd/32nd
strDay = "nd ";
else if ((now.getDate() == 3) || (now.getDate() != 13) && (now.getDate() % 10 == 3)) // Correction for 13th and 3rd/23rd/33rd
strDay = "rd ";
else
strDay = "th ";
document.write(dayName[now.getDay()] .....
// End -->
</script>
and turn it into a function called time.
XHTML Source
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "[URL]">
<html xmlns="[URL]" xml:lang="en">
<head>
<title>Test</title>
</head>
<body>
<strong><script type="text/javascript">time()</script></strong>
</body>
</html>
Javascript Source
Code:
function time() {
var strDay;
if ((now.getDate() == 1) || (now.getDate() != 11) && (now.getDate() % 10 == 1)) // Correction for 11th and 1st/21st/31st
strDay = "st ";
else if ((now.getDate() == 2) || (now.getDate() != 12) && (now.getDate() % 10 == 2)) // Correction for 12th and 2nd/22nd/32nd
strDay = "nd "; .....
But when I do the out put returns nothing. Why this might be. I initially thought that I had the formattingsyntax wrong for the function it self but this doesn't seem to be. [URL]
View 7 Replies
View Related
May 7, 2009
What's supposed to happen is when the program is run the user clicks on "Select your Numbers!" their then asked for 5 numbers which they input and then the numbers are checked by a function called �isAlreadySelected� for duplicates and if there is an alert is shown. When 5 numbers are entered correctly then they are shown by a window.alert.
Its done in to 2 functions
When I run the below code I'm prompted for the 5 numbers but it isn't checking for duplicates and my selection is undefined.
View 2 Replies
View Related
Apr 22, 2010
I'm fairly new to writing script and so can only assume I have got something incorrect because the 'ages' are failing to change by -1 when the month and day is greater than the current date.
function currentAge(value){
var theDOB = value;
var theDOB = theDOB.split('/');
var DOBday = theDOB[0];
var DOBmonth = theDOB[1];
var DOByear = theDOB[2];
var todaysDate = new Date()
var yr = todaysDate.getFullYear();
var mth = todaysDate.getMonth() +1;
var dayy = todaysDate.getDate() +1;
var theAge = (yr -DOByear);
var yearBefore = (theAge -1);
if (mth <= DOBmonth && dayy < DOBday) {
return yearBefore;
}
else {
return theAge;
}}
View 1 Replies
View Related
Mar 30, 2010
I've not been doing javascript too long and it's my first forray into AJAX so maybe a glaring error.
I'm writing and approve/delete function for a website's pending memberslist in my approveMe script firebug says doWork is not defined.
View 3 Replies
View Related
Mar 15, 2010
outputting the results from a javascript search function onto a new page. Right now I am using a javascript search script on 7 pages and it works but the results overwrite the current page that the search was initiated from. I would like it to open a new page and print out into a specific area. Im not really proficient in js, tho I know enough to get by. since ive been grinding my gears at work trying to get this to display right. I'll post the code tomorrow morning when I get to work so you can see the function.
View 2 Replies
View Related
Jul 26, 2011
I wrote a program which showing the difference of two auto generated values. its working perfectly but when i tried to set if() operator to make sound if the difference higher then 7 its not working.
I think something wrong in my code.
Orginal working code here...
But when i put if() operator under processdata() function the whole things hanged and no sound are palying.
I applied it like this way.
I dont know why its not working....i want to play and stop sound name sample.wav from my harddrive if difference range higher or lower than 7.....
View 1 Replies
View Related
Jul 23, 2005
I'm working on some code and am running into brick walls. I'm trying
to write out Javascript with Javascript and I've read the clj Meta FAQ
and didn't see the answer, read many similar posts (with no luck
though), and searched through the IRT.ORG Faqs
(www.irt.org/script/script.htm).
The Javascript is designed to open an popup window and then inside that
window call another script which will resize that window. There may be
another way around this but the reason I tried this approach initially
was that I wanted to call the onload handler in the popup window to
resize the image only after the image had completely loaded. I've had
some code in the primary Javascript file (showimage.js) before that
works if the image has been cached but on the first load, it doesn't
resize properly which tells me it is probably because it is trying to
resize the window based on the image size but it isn't completely known
at that point. So I removed that code and tried placing the resizing
code in the second Javascript file (resizewindow.js). BTW I've tried
other code to open a popup image and automatically size it ie Q1443 at
irt.org but that doesn't do exactly what we need.
Even if there is another way to do this with one file, I still want to
figure out why this isn't working in case I run into it in the future.
I thought what I would need to do to use document.writeln to write
Javascript would be to escape any special characters and to break
apart the script tag ie
document.writeln('</SCRIPT>');
would become
document.writeln('</SCR' + 'IPT>');
I have a HTML page and 2 Javascript files. All files are in the same
directory and have permissions set correctly.
Here are the 3 files (keep in mind wordwrap has jacked up the
formatting):
index.html
----------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<SCRIPT type="text/javascript" LANGUAGE="JavaScript1.1"
SRC="showimage.js">
</SCRIPT>
</head>
<body>
Click the house<BR>
<A ONCLICK="newWindow1('house1.jpg','Nice House')"><IMG
SRC="house1thumb.jpg"></A>
</body>
</html>
showimage.js
------------
function newWindow1(pic,sitename)
{
picWindow=window.open('','','width=25,height=25,sc rollbars=1,resizable=1');
picWindow.document.writeln('<html> <head>');
picWindow.document.writeln('<SCR' + 'IPT type="text/javascript"
LANGUAGE="JavaScript1.1" SRC="resizewindow.js"></SCR' + 'IPT>');
picWindow.document.writeln('</head>');
picWindow.document.writeln('<body onload="resizewindow();">');
picWindow.document.writeln('<img src=' + pic + '>');
picWindow.document.writeln('</body> </html>');
picWindow.document.close();
}
resizewindow.js
---------------
function resizewindow()
{
// Do resizing here.
// Right now this isn't being executed
alert("resizing window");
}
Can anyone provide some pointers as to why this javascript is failing?
I'm using IE6 on Win2k and when I click on the image to open the popup
window, it does open the window but it is white with no content and the
system immediately goes from about 4% CPU usage to 100% and
consistently stays there until I kill that window with the task
manager.
View 9 Replies
View Related