Finding A Multiple - Can't Get The Numbers To Relate To Each Other

Apr 12, 2010

I'm writing a function multiple that determines, for a pair of integers, whether the second one is a multiple of the first. The function has to take two integers and return true if the second is a multiple of the first. I have two text fields and a button to initiate the calculation but I can't get the numbers to relate to each other.

View 3 Replies


ADVERTISEMENT

Finding If Numbers In A Set Add Up To Another Given Number?

Aug 10, 2009

I have what I thought was a fairly simple problem that I would be able to solve on my own, but the code I have found is just too complicated for me to understandI think what i have is similar to the knapsack problem, but I have a really simple version of/~moshe/recor/knapsack/knapsack.html#defSay I have a relatively small array of numbers:2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 7, 8, 9, 10. I just need to verify true or false if a combination of these numbers will add up to 21. The numbers will obviously be changing, ( and in array size), i guess i could just use if statements but it would be stupid and go on for ages.Could anyone point me in the direction of some simple code, or easy to understand way to go about this problem?

View 20 Replies View Related

JQuery :: Finding The Multiple Values?

May 11, 2009

<pre><code><font size="4"><span>

Is there a way to find multiple values?This script checks <u>name = ben</u>, what about I want to check if <u>name = ben</u> and <u>name = joe</u>?

var</span><span> items </span><span>=</span><span> </span><span>[{</span><span>id</span><span>:</span><span>1</span><span>,</span><span> name</span><span>:</span><span>'bob'</span><span>},</span><span> </span><span>{</span><span>id</span><span>:</span><span>2</span><span>,

[code]....

View 1 Replies View Related

JQuery :: Finding Multiple Items?

Nov 9, 2010

I have a table containing multiple rows (tr), each row has two columns (td). In the first columnIhave acheckbox, when this checkbox is clicked i need it to change the class of a div in the second column of the row.

[Code]...

View 2 Replies View Related

Multiple Tracking Numbers On The Same Page?

Jul 9, 2010

I put this code together so it can assign appropriate links to tracking numbers provided by shipping carriers. It works, but on the page where I need to use it sometimes I have more than one tracking number listed and div ids are the same, so on click on any tracking number it always takes the value of the first div listed on the page. Is it possible to change something in the code so it can work for multiple tracking numbers on the same page?

[Code]....

View 14 Replies View Related

Multiple Array And Random Numbers ?

Nov 10, 2010

I have a quick question with multiple array and random numbers. If i generate my random numbers in one array, how would i take a selection of those numbers and put them in another array?

Ex: array 1: 25, 34, 38, 40, 22, 49

Want to move numbers between 30 and 50 to another array.

array 2: 34, 38, 40, 49

Is it as simple as for loops and if statements setting the conditions? do i use a sorting method? (selection? bubble?)

View 17 Replies View Related

Problem With Multiple Text Boxes Using Formated Numbers

Aug 13, 2007

I'm primarily a database programmer (Mysql and PHP) but I have some Javascript programming and I have been programming in other languages for over 25 years.

On to my problem:

I'm trying the create a function in Javascript which will take a variable from three different text boxes and show the net result in a fourth text box that is ReadOnly. This is all on the same page. All three text boxes have other Javascript scripts formatting the value in the text boxes.

Real example (simplified)....

View 2 Replies View Related

Include Numbers And Alphabets Instead Of Numbers Only?

Apr 7, 2009

I need to modify the script showed at: [URL]

Right now it allows entering "numbers only", I need it so that it allows numbers and alphabets only, no special characters or spaces.

And yes, one more question, does the first part of the code need to be added in the <head> of the document or <body> ?

The code at the above URL is as follows:

<script type="text/javascript">
// initialise variable to save cc input string
var cc_number_saved = "";
</script>

[Code].....

View 2 Replies View Related

Finding X, Y Of Div?

Feb 10, 2010

I have a div, which can be anywhere in the document. I want it like, when I click anywhere on the div, it tells me the X, Y of the mouse in the div. Like X mouse - X div (left) and Y mouse - Y div (bottom). So that I know the width and height of the mouse according to the div. Is it possible or cross browser?

View 9 Replies View Related

Finding Document URL

Jul 23, 2005

How can I findouf the URL that the webpage came from?

Like document.address or something?

View 2 Replies View Related

Need Help With Finding The Dimensions Of A Div.

Oct 2, 2006

I have a div which wraps a table. Initially, the div's display attribute is "none", basically I need to find the height of the table in the div, and use that information to render the div to the user. The div is rendered only on the users request.

View 1 Replies View Related

Finding Value In Array

Feb 3, 2006

This is just some functionality missing in the Array object that I'd find very useful...

Array.prototype.inArray=function(oObject){
for(var i in this){
if(this[i]===oObject){
return true;
}
}
return false;
}

to use:

var oObj=new Object();
var aArray=[1,oObj,"string"];
aArray.inArray(1); // returns true
aArray.inArray(oObj); // returns true
aArray.inArray("string"); // returns true
aArray.inArray(2); // returns false

View 2 Replies View Related

Finding The Height Of A Div

Apr 4, 2006

I want to be able to find the height of a div in pixels without defining it in JavaScript. The Div needs to be able to have whatever content in it is required, and it will change without a refresh. I have no idea what could possibly do this, I was hoping somebody with more experience with JavaScript could help me :D

It also really needs to be at least Internet Explorer, Firefox and Opera proof.

View 3 Replies View Related

JQuery :: Finding A <p> In A <div>?

Jul 22, 2010

Title doesn't really give this thread justice ... I have a content div with an image and text included into it. This same div class is being used multiple times. What I want is to be able to click the image, and have the <p> in that div toggle to show or hide. Here is the XHTML code for the front-end:

<div class="content">
<img src="image_big.gif" alt="image" class="toggle_font" />
<p> Caption for the next image. </p>

[code]....

View 7 Replies View Related

Finding The Position Of A Div?

Sep 28, 2005

How can I get the position of an element such as a div?

View 2 Replies View Related

Finding User Login ID

Jul 23, 2005

I'm trying to make some changes to the Javascript portion of our
corporate intranet site and I'm trying to find if theres a way to find
the User's login id from a Javascript function?

If not, is there a way to run a 'echo %USERNAME%' from DOS command
window and obtain the output. I realize there's an inherent security
risk if Javascript were to allow that.

Am I barking on a completely wrong tree, is NTLM authentication what I
should be looking at?

Basically, I need to get the user id without the user having to supply
it on the page manually. Can this be automated?

View 2 Replies View Related

Finding Out If A String Contains Characters

Jul 23, 2005

I would like to check if a string is a valid zip code via Javascript.
Length and existents are already checked.

How can I find out if the string contains characters other than numbers?

Example: 834F7
schould be false since it countains an F character

View 4 Replies View Related

Finding Text On Webpage

Sep 11, 2005

How would I access the source of a webpage? I would like to get the source,
then use a regexp to find text on a webpage. For example, retrieving a
counter, or some other text that dynamically changes. I'm implementing this
for firefox.

right now, i have a web page opening that contains that info, but i would
rather have a pop up alert() that shows that info.

View 2 Replies View Related

Finding And Replacing A Line

Jun 4, 2006

Say I have some CSS, which is several hundred lines long, with the
contents in this format:

..foo {
blah
color:#000;
blah
}
..bar {
blah
color:#FFF;
}

where the selectors and their opening braces, their closing braces, and
declarations are each on their own lines (always), how can I replace a
specific declaration (line) given a unique selector and a declaration
property. For example, if I wanted the 'color' declaration property line
in the 'bar' class changed.

At the moment I'm iterating through the CSS one line at a time looking
for the selector and then looking for the declaration property (before I
hit the closing brace).

View 1 Replies View Related

Finding All Values Of A <select>

Aug 6, 2006

Is there a way to get an array with every value of a list?

document.myform.myselect.options doesn't seem to work.

View 1 Replies View Related

JQuery :: Finding An ID Then Changing It?

Jan 20, 2011

I have a link styled with css that I'd like to change with a mouse event. It's going to be on a touch screen so I'm assuming I should adopta mouseUp/mouseDown model?

[Code]..

View 6 Replies View Related

JQuery :: Finding The Right Selector?

Jan 20, 2010

i am creating a simple dynamic menu for my study with the following structure:

[Code]...

now i need to find the correct selector for the mouseout event, because now the submenu disappears if i am getting of the current element (this) of the mainmenu, but i only want it to disappear if it is not anymore over the submenu, or if the mouse goes over another element of the main menu.

View 2 Replies View Related

Finding The Width Of Any Element?

Sep 30, 2009

I'm looking to grab the width of an <li>, including padding and margins that doesn't have a set width, and has one of 'auto' or 0.

View 5 Replies View Related

Finding / Accessing DOM Object?

Oct 3, 2009

I seem to be rather bad at formulating my questions, so let me try another way; given the following:

DOM:
DOCUMENT
HTML[code]....

How do I get/set that textarea value?

View 2 Replies View Related

Finding A Sleep Functions In JS?

Mar 31, 2009

I'm looking for a sleep function in JS. An event is triggered on mouse-out. But I want the action to kick off x seconds AFTER the event. So, perhaps I'm looking for a "sleep" function in the event function?

View 2 Replies View Related

Use Js To Do Some Syntax Highlighting / Finding?

Feb 2, 2010

Alright so for my website (I've totally revamped it and what not) I want to make a code highlighter for source code / tutorials I've posted. At the moment I'm just using some css:

div.code
{
font:1em "Courier New";
margin: 10px auto 10px auto;
background-color: #FFFFFF;
border: thick solid #555555;
color: #000000;
white-space: pre;
font-size: 12;
}

So the code stays neat and in a box. But what I want to do now is somehow make a small javascript function that scans the text inside the html file etc :

[Code]...

and can format it so float and int is blue, "hello world" is red etc. As from the javascript I've done myself I can't see it being to hard. I'm just unsure how to scan for text inside like I have above.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved