JavaScript - New To Programming
Hi I recently started researching about programming and was interested
right away. I'm new to all this and need a place to start. Any help would be greatly appreciated and look forward to posting on this forum. Similar Tutorialshi every one i;m new here and i love to know programming languages and some friends adviced me to start with java script then php , and i guess i'm at the right place can you please tell how to start and where to begain i'm really don't know anything about programming
Problem: When I click the compute button, it does not do anything. It does not go to function CALCULATE and do its stuff . Please help me. This is my PHP code. Code: echo "<table border=1>"; while($row_contestant<$numrows_criteria) { $CId=mysql_result($result_contestants,$row_contestant,"CId"); $CName=mysql_result($result_contestants,$row_contestant,"CName"); echo "<tr><td width = '10'>$CId</td><td>$CName</td>"; for($start2 = 1;$start2 <= $counter;$start2++) { echo "<td><input type = 'text' name = 'cr[]' value = ''></td>"; } $row_contestant++; echo "<td><input type = 'text' name = 'rating' value = ''></td><td><input type = 'Button' name = 'getAvg' value = 'compute' onClick = calculate()></td></tr>"; } echo "</table> <p>"; } This is my Javascript calculate function code Code: function calculate() { sum = 0; for(i = 0;i<=Number(document.frmOne.counter.value);i++) { sum = sum + Number(document.frmOne.cr[i].value) } document.frmOne.rating.value = sum } The output: Any help would be highly appreciated. God Bless. IndyNS I am trying to create a dynamic form on my webpage. What I want to do is repeat this process multiple times on the same page. I know I have to have unique id's but I am not for sure how to set them. // JavaScript Document function addRowToTable(){ var tbl = document.getElementById('Division'); var lastRow = tbl.rows.length; // if there's no header row in the table, then iteration = lastRow + 1 var iteration = lastRow; // var iteration = lastRow + 1; var row = tbl.insertRow(lastRow); // cell 0 var cell0 = row.insertCell(0); var el = document.createElement('input'); el.type = 'text'; el.NAME = 'Resource[]'; el.size = 30; cell0.appendChild(el); //cell 1 var cell1 = row.insertCell(1); var el = document.createElement("select"); cell1.innerHTML + '<option value="0">Avaliable</option>' + '<option value="1">Busy</option>' //cell 2 var cell2 = row.insertCell(2); var el = document.createElement('input'); el.type = 'text'; el.NAME = 'Comment[]'; el.size = 25; cell2.appendChild(el); } Im having a problem with my Android applet I am creating using a program called Eclipse It reads the error: 'The method onCreateOptionsMenu(Menu) in the type Activity is not applicable for the arguments (Menu)'. Here is what I have written: [code] public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater awesome = getMenuInflater(); awesome.inflate(R.menu.main_menu, menu); return true; } [code] I'm currently using an automation software to automate a series of steps I perform on my computer. One of the tasks involves hundreds of If/Then loops, extracts text from websites using an embedded web browser, computes equations and write text files. The thing is, in order to share this with somebody else, they also need the same automation software installed, and then need to import it. So it's a process I'm trying to replace by creating a small program with a GUI that involves a simple installation on the user's PC (or ideally without installation). The language must be flexible enough to perform the same actions that I listed above - and more preferably. I'm a complete novice with anything besides HTML/CSS so I'm looking for A flexible programming language that isn't rocket science to learn from scratch and is ideal for small stand-alone programs The ability to create a GUI. I'd be happy to read any good reference you have about the language/design knowledge needed for GUI's. Thanks in advance hi again, I want to say thank you for all of the help and I have the last assignment that she wants us to do and I had to pull up another assignment that she wanted us to build upon( which is one of those coding without anything advance) Code: <html> <head> <title> COMSC 100 Assignment 10 by Dennis McNeill [1190802] </title> <script> function getInputAsText(_id){return document.getElementById(_id).value} function getInputAsNumber(_id){return parseFloat(document.getElementById(_id).value)} function setOutput(_id, _value){document.getElementById(_id).value = _value} function calculate() { // declare all variables var variable1 var variable2 var variable3 var variable4 var variable5 // get variable's value = getInputAsNumber() = getInputAsNumber() // perform concatenation // write output value setOutput("resultAsText",resultAsNumber) } </script> </head> <body> Directions:<br> Type 5 numbers and click go<br> The highest of the 5 will appear<br> It is okay to use a decimal point<br> Input values:<br> First<input id="variable1"><br> Second<input id="variable2"><br> Third <input id="variable3"><br> Fourth<input id="variable4"><br> Fifth<input id="variable5"><br> <input type="submit" value="go" onclick="calculate()"> Output<br> Result #1:<input id= "myResult1" size="25"> </body> </html> now she wants us to do max <beta and then name the variables with if a<b and I don't know if I put that in the concatenation or what to name my variables! ugh. NOT ASKING TO DO MY HOMEWORK Hi so i am using onClick="myPopup(); on a button and when someone clicks on the button, it pops up an advertisement in a new tab. But is there a way to make the users stay on the page where the button is located instead of forcing the browser to automatically switch to the advertisement tab when a button is clicked? I'm new to programming in general and have had trouble deciding on a good starter project. I've decided to start with something that is (hopefully) pretty simple. I have about a dozen boxes full of vinyl records and would like to write a program to catalogue everything alphabetically by artist using prompts to ask for Album Title, Artist Title, and year. My question at this point is, is JavaScript a good way to do this? I have a fundamental knowledge of HTML, CSS, JavaScript and Ruby. I assumed JS would be the best way (that I know at this point) to do this project, but if I'm wrong, would love to hear it. What I don't understand at this point is how to output the information to a text file, or how to set up an interface to run the scripts. Any advice is very much appreciated. I have written my application by specifying all dimensions in pixels. If used on a monitor with less resolution, it causes the screen to have to scroll left or right. However, it seems to be the same top to bottom. In any event, I was wondering if there is a way to specify pixels maybe through a function or something, where the client's monitor resolution can be detected, and then, if I specify a size as 100px, I can change that to something like pixCount(100). Greeting Everyone, Can anyone breakdown the differences between programming languages in VERY VERY BASIC plain English? (i.e. HTML use for website format, CSS used for the graphics on the webpage) Here's what I have questions about: 1. Differences between the most commonly used programming languages for software/web development (Javascript, Ruby on Rails, Phyton, etc.). 2. How do you determine which programming languages to use? 3. What factors are considered? Thank in advance for the people that reply. =) Hi everyone-- I am a fourth grade teacher and I have an idea for a program I could use with my students. I think (key word, I don't know anything about programming) that it should be relatively simple to do. A short description of what the program would do will follow, but my posting is for three main reasons: 1) Is this possible? (I assume it is) 2) As I would be willing to pay for this (up to a certain amount), how much might it cost me if I hired a freelance programmer? 3) Is there anyone out there who would be able to help me with this? Okay, as for the program: it would be a program that would make your own "Jack Attack" (like from the computer game "You Don't Know Jack"). It would give you a place to input up to 10 to 15 keywords (or vocabulary definitions) for the middle and keywords (or vocab words) that would fly past. It would respond to some sort of button input (I'm thinking space bar)....and have an action for wrong answers (buzzer sound) and an action for a right answer (ding! and then move on to next question). Maybe after the game it would give a readout of how many right out of how many possible. It would be really cool to be able to have some background music, maybe manipulate the the colors, fonts, etc. I am wanting to leave the program kind of generic so that I could use this for all sorts of applications: use it for vocabulary words in different subjects, match authors with books, "just for fun" games, maybe even use it for some math facts. Any information you would have is more than appreciated! Thanks for helping a teacher out! Clay I have searched all over for tutorials on multiplayer game programming. I cannot seem to find anything relevant to my question, though. I don't even think that I can use javascript, but as I said, I do not know where to start. All I want, for now, is to make something simple like tic-tac-toe or rock-paper-scissors, which will be played by two users on two machines. Then once I've gotten that, I can move onto making something more in depth. Any push in the right direction is greatly appreciated! -Shane Hello all, I am having some trouble getting my Javascript code to work properly. I want to create a program that allows two objects to race to a certain point which is 1000px in my program. I have figured out how to get the images to race at random speed, and I have figured out a function to reset the program if the user chooses to restart. Basically I can't figure out how to get the clearTimeout() to stop the Race() function when it reaches 1000px. I am fairly new to the Javascript world and could really use some suggestions or a point in the right direction. Thanks in advance, AJ. Here is my program so far: <body> <script language="JavaScript" type="text/javascript"> <!-- function StartUp() { if ((car1.style.pixelLeft<1000) && (car2.style.pixelLeft<1000)) { Race(); } else { alert(); } } function Race() { car1.style.pixelLeft+=(Math.floor(Math.random()*11)); car2.style.pixelLeft+=(Math.floor(Math.random()*11)); stop=setTimeout("Race()",50); } function Restart() { clearTimeout(stop); car1.style.pixelLeft=10; car2.style.pixelLeft=10; } function swapImage() { var image = document.getElementById("imageToSwap"); var length = document.getElementById("Road"); image.src = Road.value; } //--> </script> <div id="car1" style="position:absolute; top: 10"> <img src="Car1.gif" alt=""/> </div> <div id="car2" style="position:absolute; top: 75"> <img src="Car2.gif" alt=""/> </div> <img id="imageToSwap" src="Road1000.gif" alt=""/> <form name="form1"> <br> <input type="button" value="Race" onClick="StartUp()"> <input type="button" value="Restart" onClick="Restart()"> <br> Track Length: <select id="Road" name="Road" onChange="swapImage()"> <option value="Road1000.gif">1000 feet</option> <option value="Road750.gif">750 feet</option> <option value="Road500.gif">500 feet</option> <option value="Road250.gif">250 feet</option> </select> </form> </body> Okay so if you go to this website: http://gameusd.com/ You can pick your game & country -- say its world of warcraft US And then you pick your realm and faction, and then it gives you the prices on those particular realms/factions. What i wanted to know was if it was possible to somehow make a program that fetches the prices of EVERY single realm/faction and lists them all side by side and in order of lowest to highest price or whatever. Would massively appreciate if somehow could tell me if its possible. Because obviously doing it all manually would be a huge pain in the *** and take hours. I need to know two things. How do you position an alert or prompt to anywhere on the screen. How do you change the font for the alert or prompt (i.e Hebrew) Thanks in advance D.A. I have traditionally stayed away from javascript because until relatively recently, the lack of decent documentation has made me want to smash the computer in complete frustration!! Now, I have found this little (seemingly quite new) gem which has, for the first time, explained javascript OO programming to me in five minutes flat, and I understand it perfectly!! It's not hard ... it's really not that hard ... but so many people on the net make such a hash of trying to explain it. Thank you Mozilla: https://developer.mozilla.org/en-US/...ted_JavaScript Hi, I have been trying to create a google graph from an input combobox but I'm having trouble passing the variable to the query on the spreadsheeet. The graph is able to query the spreadsheet when I don't use a varible, and my combobox is recieveing the variable but I'm having trouble connecting the two. The code I'm trying to use is below and I also attached a text file, so any help would be so fantastic! This is the code I have for it: Code: <!-- try 1 Rivas, try 2 San jose You are free to copy and use this sample in accordance with the terms of the Apache license (http://www.apache.org/licenses/LICENSE-2.0.html) --> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title> Google Visualization API Sample </title> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('visualization', '1', {packages: ['linechart']}); </script><script src="http://www.google.com/uds/?file=visualization&v=1&packages=linechart" type="text/javascript"></script><script src="http://www.google.com/uds/api/visualization/1.0/3dc85ad905db9d2ce85ec8d8389c32d5/default,browserchart,linechart.I.js" type="text/javascript"></script> <script type="text/javascript"> function storeValue(obj){ if(obj.selectedIndex == 0){return;} var MonthChosen = obj.value; alert('You chose: '+ MonthChosen); } window.onload = function(){ document.getElementsByName('combo1')[0].onchange=function(){storeValue(this);} } var visualization; function drawVisualization() { // To see the data that this visualization uses, browse to // http://spreadsheets.google.com/ccc?key=pCQbetd-CptGXxxQIG7VFIQ var query = new google.visualization.Query( 'https://spreadsheets.google.com/ccc?key=0Ais9xMj35wQmdDBTMUxHRS1CRHVkcGI4dnZ0c2xLZXc&hl=en'); // Apply query language. query.setQuery('SELECT H WHERE E ="MonthChosen" ORDER BY F'); // Send the query with a callback function. query.send(handleQueryResponse); } function handleQueryResponse(response) { if (response.isError()) { alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage()); return; } var data = response.getDataTable(); visualization = new google.visualization.LineChart(document.getElementById('visualization')); visualization.draw(data, {legend: 'bottom'}); } google.setOnLoadCallback(drawVisualization); </script> <h2> What month would you like to see the 10 year comparative data from?</h2> <form> <table> <tbody><tr> <td>Combo Box</td> <td> <select id="combo1" name="combo1" onchange="input1.value = combo1.value"> <option value="’1’">January</option> <option value="’2’">February</option> <option value="’3’">March</option> <option value="’4’">April</option> <option value="’5’">May </option> <option value="’6’">June </option> <option value="’7’"> July</option> <option value="’8’">August </option> <option value="’9’">September </option> <option value="’10’">October </option> <option value="’11’">November </option> <option value="’12’">December </option> </select> </td> </tr> <tr> <td>Input Box</td> </tr> </tbody></table> </form> <div id="visualization" style="height: 400px; width: 400px;"></div> I have a simple project that is getting me stuck. The current submission is included. The question is: Write a class named Acc2 containing: An instance variable named sum of type integer, initialized to 0. A method named getSum that returns the value of sum . This is my current sumbission: public class Acc2 { private int sum = 0; public int getSum (){method sum;} } The system says that the only thing wrong with it is the bold word method. I have tryed many things in place of it however I am unable to move on. I am trying to display code on a web page in a readable and formatted fashion with color highlighting idealy. I am assuming that something of this nature would have to be done with javascript to calculate the css styling based on the keywords. Been trying to find something on this for a while but cant find anything Any suggestions would be appreciated |