Javascript Definition and 73 Threads

  1. M

    Java Why Doesn't the JavaScript Power Function Work?

    write an if statement that checks if the parameter exponent is 0. If it is, return 1 (a base case). var power = function(exponent, base){ if (exponent === 0){ return 1; } }; power(); It does not work, ca anyone tell why?
  2. M

    Java [Javascript?] help with functions: isOdd in terms of isEven

    Problem statement: Define isOdd function, and then define isEven function in terms of isOdd function. My attempt is ridiculous: var isOdd = function (x){ if (x % 2 ===0){ return isOdd; }else{ return "is even"; } }; var isEven = function (){ return; };
  3. M

    Java [Javascript?] Using a function as an argument for another function

    var square = function (x) { return x * x; }; var cube = function (x) { return square * x; }; This is my shot, its not right. Please indicate or suggest the correct answear. :)
  4. M

    Java JavaScript arrays and loops combination question

    var lost = [4, 8, 15, 16, 23, 42]; var count = lost.length; var isLost = function (n) { for (i=lost[0]; i<count; i=lost[i+1]) { if ( n === lost[i]) { return "true"; } } return "false"; }; is it possible to in corporate array positions into the for loop? (i) do...
  5. M

    Java JavaScript crashes while squaring number

    Is this a legit code for printing out squares of numbers betwean 100 and 150 ? Seems to crash everytime. for (var i=100; i<151; i*i) { var square = i; console.log(square); } Need help :)
  6. A

    Java Understanding Array Initialization in JavaScript

    The general form for creating an array is: Myarray=new arrayname(); But I don't understand wht should I type in the name of the array twice? Because I thought Myarray and arrayname is the same.
  7. M

    Java Lognormal cumulative distribution function for JavaScript?

    Hey everyone! I'm building a "Deal or No Deal" calculator that estimates the odds of getting a better deal than the one presented. As you can see in the title, I'm looking for a function that will calculate the CDF. For ease's sake, please only post JavaScript code (no C,Perl,BASIC,etc.)
  8. P

    Comp Sci JavaScript Problem: Code Access Between Frames

    Homework Statement I'm required to make a page that has the following format: Left Frame Items with prices and check boxes next to them An "Update Order" button at the bottom so the order details on the Right Frame can be updated. Right Frame A "receipt" form with all the...
  9. J

    Java Javascript - Reducing a number to smaller numbers

    I am looking for advice on how to approach a problem. I would like to take a given number and break it into 7 parts. For example, the function call, BreakIntoSmallerNumbers(15); would return the following array: [3, 2, 2, 2, 2, 2, 2] BreakIntoSmallerNumbers(3); returns [1, 1, 1]...
  10. Saladsamurai

    Java Adobe Acrobat 9: Javascript: Merge Odd/Even Pages

    Hey folks I don't know if anyone can help with this, it should be straightforward though. I have a 2 PDF documents called Doc1.pdf and Doc2.pdf. Doc1 contains all of the odd numbered pages of a main document and Doc2 contains the even ones. I would like to merge the Doc2 even pages into Doc1...
  11. K

    Java Build a Complex JavaScript Calculator

    Hi guys. I am mechanical engineering undergraduate and we have a website. Now we want to put up an interactive calculator on our website. So we are trying JavaScript. Though we tried writing a code for our calculator it didn't work. At this time we're getting confused because of level of...
  12. T

    HTML/CSS Where can I find free online resources to learn HTML, Javascript, and CSS?

    I am trying to learn these web designing stuff on my own and am currently using http://www.w3schools.com/html/default.asp for HTML learning... and though i am well aware of the basics ..i need to know much in depth. So do you guys have any good 'n' free online resources to learn HTML +...
  13. K

    Java Gaint Cursor in JavaScript, Framing Pandora (for visually impaired user)

    My brother is low vision and I wanted to create a web page on our local computer that will use a large cursor in JavaScript (I've heard this is possible) while being a frame around the pandora radio website, to make is easier for him to see the cursor. Alas, most of my programming experience...
  14. C

    Java Is there a javascript or php code to remove browsing history?

    I want to remove my clients browsing history every time they access new pages from my website. is there any code, i keep searching the net and i can't find one.
  15. T

    Java I am stuck with a little javascript problem

    I am using scripting my webpage's tabs I have 5 tabs and I'd like the tab animation I am learning to make a selected tab to be... a selected tab. I'd like this to be done in css I'd like the mouse pointer not to be changed into a hand when the mouse is over the selected tab. That's it I mean...
  16. R

    Comp Sci Generate Random Images with JavaScript: Basic Program Help Needed

    Homework Statement I'm supposed to write a program that upon clicking a command button generates a random number, and displays 1 of 7 images that is associated with the random number generated. Ive been at this for a few hours and can't get the image to change. EDIT: Upon further testing it...
  17. G

    Java Can JavaScript Bookmarklets Modify Text Selections and Clipboard Contents?

    can one write a javascript bookmark that will print a single unicode character (like a smiley face or a math symbol) to the clipboard (or better still straight to the cursor position)? how about print something like (SUB) to the clipboard then append what is highlighted to the clipboard then...
  18. U

    Java Mixing blogs using javascript or other means

    Is it possible with javascript to take one article from blog A, one article from blog B, one article from blog C, and show them all together in one big table, with one article per table cell? Even better, is it possible to mix blogs as above but without duplicating content on an intermediate...
  19. Hootenanny

    Java How can I hide DIVS with JavaScript on page load?

    I have some divs on a web page, with the class name "hans" which I would like to hide with JavaScript when the page loads. The reason I have it set up this way is so that the user can reveal the div's by clicking a link, but if JavaScript is disabled, the div's will be displayed by default...
  20. DaveC426913

    Java Frontpage JavaScript: Understanding the Code Block

    I'm looking at this site that I may need to modify. It was built in Frontpage. I'm not familiar with FP. There's a block of code the top like this: <SCRIPT type="text/javascript"><!--...
  21. B. Elliott

    Java How can I add a Deep Impact countdown to my forum signature using Javascript?

    I was wanting to have a simple copy of the Deep Impact countdown on my signature in another forum. I've really been racking my brain trying to figure this out, and to no avail. http://www.space.com/deepimpact/ any help would be GREATLY appreciated. B. Elliott
  22. V

    Java Learn How to Create a Custom JavaScript Message Box | Step-by-Step Guide

    When my users click a button or a link etc, to get out or to get known what I would like to tell them, they will always see "Javascript Application" and below it is my message written. Now, I would completely be able to GET IT OUT OFF MY MESSAGEBOX, that TITLE...How can I make this ? Could you...
  23. I

    Java Trouble Submitting Form with JavaScript

    I'm having trouble sumbitting a form using javascript. The form has a submit button (type=button) that used to be type=submit. i have change it's properties so that it now calls a function that later submits the information. the problem I'm having is that when i click the submit button the...
Back
Top