JavaScript - New To Programming A Script Writing In Need Of Assistance Plz
hi i am new to programming and script writing
i would like to ask if anyone on here wouldn't mind taking a couple min out of there day to help me out with a few things I am really stuck right now on just getting started with what i need to START i know that that is probably a pretty big question so i will start out small and just ask what are some of the basic essentialls that i will need to get started. Wile telling me how to get started if you wouldn't mind just giving me a short description of the proper use of thing and just what i should look for if i am doing things properly or incorrect like i said before i am only just starting out and i would like to start small and just more or less get the ball rolling. I work with computers most of the day and hooking up internet and would like to further my knowledge with the future (computers). i am a part of lots of forums mainly pertaining to jeeps and we are always trying to help the little guys out in getting bigger and more knowledgeable about what they are getting into and i am hopping that it is the same way here and in this area or expertise thanks again i look forward to starting out Similar TutorialsI am trying to create a form where you are able to calculate what a total car cost would be based on a 6.25% of the CarAmount. Then I would like to be able to add $125 that with is TitleProcess and then $99 to that which is the LicenseFee. Right now I have not been able to get the tax to work on this code. If someone could get this all to work that would be great, or else even if you program your own code. Thank you so much! <form action="POST" name="myform"> <table border="1" bgcolor="#006666"> <tr> <td align="center" colspan="2"> <script language="JavaScript"><!-- function CarLoanCalculator() { form = document.myform CarAmount= form.CarAmount.value DownPayment= "0" AnnualInterestRate = 625/100 TitleProcess= 125 MonthRate=AnnualInterestRate/12 NumPayments=TitleProcess*12 Prin=CarAmount-DownPayment MonthPayment=Math.floor((CarAmount*AnnualInterestRate)+TitleProcess)) form.NumberOfPayments.value=NumPayments form.MonthlyPayment.value=MonthPayment } // --></script> <font color="#FFFFFF" size="2" face="arial narrow"><b>Car Loan Calculator</b> <br> Enter Your Details & Click the Calculate Button</font></td> </tr> <tr> <td> <table border="0" cellpadding="2"> <tr> <td align="right"><font color="#FFFFFF" size="2" face="arial narrow">Car Loan Amount $ </font></td> <td><font color="#FFFFFF" size="2" face="arial narrow"> <input type="text" size="10" name="CarAmount" value="" onBlur="CarLoanCalculator()" onChange="CarLoanCalculator()"> <br> </font></td> </tr> <tr> <td align="right"><font color="#FFFFFF" size="2" face="arial narrow">Annual Interest Rate </font></td> <td><font color="#FFFFFF" size="2" face="arial narrow"> <input type="text" size="3" name="InterestRate" value="6.25" onBlur="CarLoanCalculator()" onChange="CarLoanCalculator()"> % <br> </font></td> </tr> <tr> <td align="right"><font color="#FFFFFF" size="2" face="arial narrow">Term of Car Loan </font></td> <td><font color="#FFFFFF" size="2" face="arial narrow"> <input type="text" size="3" name="NumberOfTitleProcess" value="125" onBlur="CarLoanCalculator()" onChange="CarLoanCalculator()"> TitleProcess<br> </font></td> <td><font color="#FFFFFF" size="2" face="arial narrow"> <input type="button" name="morgcal" value="Calculate" language="JavaScript" onClick="CarLoanCalculator()"> </font></td> </tr> <tr> <td colspan="3"><font color="#FFFFFF"></font></td> </tr> </table> </td> </tr> <tr> <td> <table border="0" cellpadding="2"> <tr> <td align="right"><font color="#FFFFFF" size="2" face="arial narrow"> Number of Car Payments </font></td> <td><font color="#FFFFFF" size="2" face="arial narrow"> <input type="text" size="7" name="NumberOfPayments"> <br> </font></td> </tr> <tr> <td align="right"><font color="#FFFFFF" size="2" face="arial narrow">Monthly Payment $ </font></td> <td><font color="#FFFFFF" size="2" face="arial narrow"> <input type="text" size="7" name="MonthlyPayment"> <br> </font></td> </tr> <tr> <td align="center" colspan="2"> </td> </tr> </table> </td> </tr> </table> <div align="center"></div> </form> Hello everyone. First, if you do not understand something I have tried to explain, PLEASE ask, don't just skip the question! Thank you! I will start by explaining what I am doing and why I am running into a problem. Perhaps one of you kind people can help me figure out how to fix it. I have a grid set up for logic puzzle solving. The grid is made up of 3 rows of primary squares, each containing 16 sub-squares. The top row has 3 primary squares. the 2nd row has 2 primary squares. the 3rd row has 1 primary square. That gives a total of 96 sub-square, or grid coordinates. Each sub square has an image in it that can be altered by clicking the square. The image begins as a blank gif. With the first click, it becomes an X, with a second click, it becomes an O, and the third click returns it to blank. With me so far? Hope so! Now for the tricky part. The grid is made up using a table, with each TD having it's own identifier, as in: Code: a1b1 a1b2 a1b3 a1b4 | a1c1 a1c2 a1c3 a1c4 | a1d1 a1d2 a1d3 a1d4 a2b1 a2b2 a2b3 a2b4 | a2c1 a2c2 a2c3 a2c4 | a2d1 a2d2 a2d3 a2d4 a3b1 a3b2 a3b3 a3b4 | a3c1 a3c2 a3c3 a3c4 | a3d1 a3d2 a3d3 a3d4 a4b1 a4b2 a4b3 a4b4 | a4c1 a4c2 a4c3 a4c4 | a4d1 a4d2 a4d3 a4d4 ----------------------------------------- d1b1 d1b2 d1b3 d1b4 | d1c1 d1c2 d1c3 d1c4 d2b1 d2b2 d2b3 d2b4 | d2c1 d2c2 d2c3 d2c4 d3b1 d3b2 d3b3 d3b4 | d3c1 d3c2 d3c3 d3c4 d4b1 d4b2 d4b3 d4b4 | d4c1 d4c2 d4c3 d4c4 ----------------------------------------- c1b1 c1b2 c1b3 c1b4 c2b1 c2b2 c2b3 c2b4 c3b1 c3b2 c3b3 c3b4 c4b1 c4b2 c4b3 c4b4 Each sub-square also contains the image that is changed, and the image has it's own unique identifier, to go alone with the grid: Code: 1-0-0 | 1-0-1 | 1-0-2 | 1-0-3 | 1-1-0 |1-1-1 | 1-1-2 | 1-1-3 | 1-2-0 | 1-2-1 | 1-2-2 | 1-2-3 | ---------------------------------------------------------------------------------------------- 2-0-0 | 2-0-1 | 2-0-2 | 2-0-3 | 2-1-0 | 2-1-1 | 2-1-2 | 2-1-3 | 2-2-0 | 2-2-1 | 2-2-2 | 2-2-3 | ---------------------------------------------------------------------------------------------- 3-0-0 | 3-0-1 | 3-0-2 | 3-0-3 | 3-1-0 | 3-1-1 | 3-1-2 | 3-1-3 | 3-2-0 | 3-2-1 | 3-2-2 | 3-2-3 | ---------------------------------------------------------------------------------------------- 4-0-0 | 4-0-1 | 4-0-2 | 4-0-3 | 4-1-0 | 4-1-1 | 4-1-2 | 4-1-3 | 4-2-0 | 4-2-1 | 4-2-2 | 4-2-3 | ------------------------------------------------------------- 5-0-0 | 5-0-1 | 5-0-2 | 5-0-3 | 5-1-0 | 5-1-1 | 5-1-2 | 5-1-3 | ------------------------------------------------------------- 6-0-0 | 6-0-1 | 6-0-2 | 6-0-3 | 6-1-0 | 6-1-1 | 6-1-2 | 6-1-3 | ------------------------------------------------------------- 7-0-0 | 7-0-1 | 7-0-2 | 7-0-3 | 7-1-0 | 7-1-1 | 7-1-2 | 7-1-3 | ------------------------------------------------------------- 8-0-0 | 8-0-1 | 8-0-2 | 8-0-3 | 8-1-0 | 8-1-1 | 8-1-2 | 8-1-3 | ------------------------------ 9-0-0 | 9-0-1 | 9-0-2 | 9-0-3 | ------------------------------ 10-0-0 | 10-0-1 | 10-0-2 | 10-0-3 | ---------------------------------- 11-0-0 | 11-0-1 | 11-0-2 | 11-0-3 | ---------------------------------- 12-0-0 | 12-0-1 | 12-0-2 | 12-0-3 | Here is a sample of a TD including the image and other ID's: Code: <TD style=" border-bottom: 3px solid black;" class="gridoff" onMouseOver="className='gridon';" onMouseOut="className='gridoff';" id="gridtdD4C2"> <DIV align="center"> <IMG src="/testproject/n.gif" height="20" width="20" id="8-1-1" name="D4C2" onClick="flipBox(this);" class="gridbox"> </DIV> </TD> As you can see, the image ID is 8-1-1, which if you compare the two tables, is equal to D4C2. So far, everything is working perfect, as long as I have a grid that is 3x3x4, or, 3 squares across the top, 2 squares in the middles, and 1 square on the bottom, with 16 sub-squares in each. Now, the problem is, I do not always need a 3x3x4, sometimes I will need a 3x3x5, or a 4x4x4, or a 4x4x5 grid. I have made all the grids, and given them all the right ID's for both the TD, the IMG, as well as the <input> tags. When I test out a 3x3x5 grid, the first 4 columns in each square work fine, the 5th will only change to an X once, and cannot be changed again. Similarly, the first 4 rows in each square work, but not the 5th, with the same problem. Again, I have made sure that each of my ID's are correct, so that isn't the issue. The only thing I can figure it would be is the javascript. So, here it is, the script that does all the changes: Code: <SCRIPT LANGUAGE="JavaScript"> function checkDoubles(val) { // A4C5 = check A4C1, A4C2, A4C3, A4C4, A1C5, A2C5, A3C5, A5C5 var part1 = val.substr(0,1); var part2 = val.substr(1,1); var part3 = val.substr(2,1); var part4 = val.substr(3,1); var part12 = val.substr(0,2); var part34 = val.substr(2,2); var isdouble = "false"; // check A4C* for(i=1;i<5;i++) { var checkthisbox = part12 + part3 + i; if(checkthisbox!=val) { if(document.getElementById(checkthisbox).value==3) { alert("You can not set more than one box in any row to true at the same time! If you wish to set this box to true you must first remove the other true statement in this row."); var isdouble = "true"; } } } // check A*C5 for(i=1;i<5;i++) { var checkthisbox = part1 + i + part34; if(checkthisbox!=val) { if(document.getElementById(checkthisbox).value==3) { alert("You can not set more than one box in any column to true at the same time! If you wish to set this box to true you must first remove the other true statement in this column."); var isdouble = "true"; } } } return isdouble; } function flipBox(img) { var tmpname; if(img.src=="http://localhost/testproject/n.gif") { img.src = "http://localhost/testproject/x.gif"; tmpname = img.name; document.mainform.elements[tmpname].value = 1; document.getElementById(img.name).value = 1; } else if(img.src=="http://localhost/testproject/x.gif") { var finaltest = checkDoubles(img.name); if(finaltest=="false") { img.src = "http://localhost/testproject/o.gif"; tmpname = img.name; document.mainform.elements[tmpname].value = 3; document.getElementById(img.name).value = 3; } else { img.src = "http://localhost/testproject/n.gif"; } } else if(img.src=="http://localhost/testproject/o.gif") { img.src = "http://localhost/testproject/n.gif"; tmpname = img.name; document.mainform.elements[tmpname].value = 0; document.getElementById(img.name).value = 0; } showVals(); } </SCRIPT> I know nothing about javascript, so I have no idea why the grid is not working as it should. For some reason, 1-0-0 through 1-0-3 (A1B1 to A1B4) work, but 1-0-4 (A1B5) nor 5-0-4 (which would be A5B5 grid coord). It makes no sense to me. If you could please look over the script and tell me if you can see why it's letting the original part of the grid to work, but not the additional parts I add? Thank you! Yes, I have read the sticky about homework.. and before you call me a lazy sack, I will have to blame it all on my teacher... He knows almost nothing about the Java, and yet, he is teaching a computer programming class... This assignment is due soon, and I have no idea how you even start this..Really appreciate it if some1 can do this for me.. Assignment: Create a new 'Array' Project and create a java file that does the following. -Print your arrays going across the screen(horizontally) -Creating the arrays should be done in main -All other tasks should be in separate methods -Your arrays should be passed as a parameters -All methods should have a void return type 1.a)Create an array of 100 integers called nums. (All 1000 grades will automatically be initialized to 0) b) Fill the array with 1000 random numbers between 10 and 99. c) Print the grades forwards d) Print the grades backwards. e) Find the average of the grades and print the average 2 a) Create an array of 6 Strings called names (all 6 names will automatically be initialized to null.) b) Fill your array with 6 names (you will have to do this individually). c) Print all names that start with a vowel. Thank to so much if someone really help me with this! Hi folks. There have been several requests on this forum for subtotal/tax/total forms, but I know so little about Java scripts that I haven't been able to adapt your provided solutions to my needs. I know it seems like a cop-out to just ask someone else to do it for me, but I need to get this form functioning as soon as possible, since I'll be running business through this site (which, until now, I've designed on my own). I would like to learn JS eventually, or at least have a working knowledge of it, but I'm short on time right now. I know that a Java script should be able to do what I need it to, so if there's anyone out there who can help, I would be incredibly grateful. I hope it's not too much trouble. Here's the web page. I've kept my html nice and clean, so hopefully it's very easy to read: link What I need is to multiply the price of either size options by the quantity, add the sales tax and shipping, and the total will update automatically. The paper choice will not affect the price. Ideally, I would like the "submit request" button to send an email with all supplied information to my email address, and also send a copy to the supplied customer address. (I think that's considered a get/put script?) Again, if there's anyone who can help with this, I would be very grateful. Thanks, Jon hey guys " I have question about writing a java script code equivalent to the following figure : I've written the code like this , <html> <body> <script type="text/javascript"> var x; x = 12; while (x != 0) { document.write(" x = " + x +"<BR>"); x = x - 3; } document.write("DONE"); </script> </body> </html> is my answer right or wrong ?? < Thanks for anyone can help in advance. I currently have a photo site with photo albums of my kids to share with family and friends. I am redesigning it at the moment and trying to link streaming music to albums pages. I don't want to make multiple pages that link music and photos together. The site is broken into three frames. Frame A contains the menu buttons, Frame B should contain the streaming music, and Frame C contains the pictures. The program I am using to create the website buttons has the ability to run a java function. So basically can I create a java function that when the button is clicked on the webpage it executes the Java script and automatically loads Frame B which contain the music to go with the pictures, and load frame C to point to the corect photo album? I don't have the skill to do this and wondering if anyone can help write a code to create this? Thanks, Troy 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. 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] 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); } 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. hi 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
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? 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 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. =) 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'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 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 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). 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> |