I am really confused as similar code on Tizag web site works fine.
Code:
<script type="text/javascript">
function changeText(){
document.getElementById('boldStuff').innerHTML = 'Fred Flinstone';
}</script>
<p>Welcome to the site <b id='boldStuff'>dude</b> </p>
<input type='button' onclick='changeText()' value='Change Text'/>
Trying to figure out a problem with the "Optional" values in a list box so I am going to keep it as simple as I can..
I am trying to calculate the optional value of a list box in stead of programming it the long way around.
I created a list box with several peoples names, like John, Sue, and Mary.
I have assigned each name a numeric "optional" values
I know the code in the list box should be:
Normally, I would code this along the lines of:
But I want to figure out how to select the Optional Value from the list, and multiply it by time instead of doing the SELECTEDNAMELISTBOX=="John" route..
I have an input for Fahrenheit in degrees, then a button to start the calculations, then an input box for the result. But the result stays empty. where my Javascript code went wrong? I am modifying someone else's code form the Internet,I am guessing at how it works. [code]
The exercise problem is to "MODIFY the code in the "calculate_click" event so interest is added to future value just once each year for the number of years that they were entered by the user". The calculation as you see it below assumes an amount is invested MONTHLY (not just once), and the interest is calculated accordingly. This is what I think the problem is trying to calculate: using a $100 one time investment at 10% interest (compounded once annually) for one year = $110 as the future value. For two years, the future value should equal $121 (110 + (110*.10)). Okay, if my math is wrong, let me know. This is what I'm trying to get it to match to.
I have been able to modify the calculate_click function to compound the interest annually (it does it monthly now). Cool. I cannot get it to stop adding $100 annually. See my math above? I think that's the answer. My manipulation of the code yields $110 for the first year, $231 for the second year, etc. The $231 is incorrect cuz it adds an extra $100. See, this is a simple interest calculator I can't figure out! The original code is below that calculates the investment as a monthly investment as opposed to one-time. To avoid confusion, I did not include any of my modifications. But yeah. I know that the major culprit is how the "for" loop is being executed. I've highlighted where I think the code needs to be changed, but I haven't changed it here. Note the first function is a shortcut to execute getElementbyID.
The Code: var $ = function (id) { return document.getElementById(id); } var calculate_click = function () { var investment = parseFloat( $("investment").value ); var annualRate = parseFloat( $("rate").value ); var years = parseInt( $("years").value ); $("futureValue").value = ""; .....
I'm trying to "progressively enhance" one of my surveys using javascript. Basically, I have rating scales that make use of radio buttons as each point on the scale. Each radio button occupies its own cell in a table. I wrote some functions that will highlight cells on mouseover in a color corresponding to its position on the scale (e.g. the lowest point is red, the midpoint is yellow, the highest point is green). When a radio button is clicked, the background of the button's cell and preceding cells in the same row will be colored accordingly. The functions are working well in FireFox and Chrome (I just have to add a few lines using the addEvent function to make it compatible with IE).
The effect looks a lot nicer when I add a function that makes the visibility of the radio buttons hidden.
However, I want to make sure that there is a fallback option in case the functions that color the cells don't work for whatever reason. I would not want the radio buttons hidden in this case.
Is there a method whereby I can call the "hideRadiobuttons" function only if the other functions are successfully executed?
I have a function which is called twice. It allows the elements of an array to be set to a different color, successively:
function ln8 (arrayA,color,current) { var arrayB=(typeof arrayA == 'string')? arrayA.split(',') : arrayA; var line = document.getElementById(arrayB[current]);
I know I shouldn't be having this problem at this stage. But what have I done wrong?I have my main page, I have my onload page and in that onload page I call a function:And then I get the error message:Fatal error: Call to undefined function OpenChat.Needless to say I am trying to create an instant chat.
I am currently working on a project where I am using the jQuery Calculation plugin [URL] to do some math functions in a dynamic form, the issue is that when a new set of fields is created the calculation script only pulls data from the ones there when the page loaded, I am fairly certain that what I need to do is use the live function, however I am not very familiar with it and still learning. My jQuery for the plugin is : $("input[name^=emem]").sum("keyup", "#totalMem");
It only seems to work if no values are filled in, if one of the fields is filled in the error checking fails. Again, I'm extremely new to JS, i've only ever copy/pasted and this is the first time i've tried writing a piece.
I'm trying to create a "Books I'm Reading" widget using the Readernaut API. I'm using JSON with a callback. This is a portion of what the JSON URL returns:
I am new to Javascript. I copied this script from the web, but I get an error at this line:parent.removeChild(child);The error says "Invalid argument".
I know I have a simple syntax error. Trying to call a function which changes the style of a div element on mouseover. Heres my code. Javascript function countermarker1(){ var box1 = document.getElementById('countermarker1box').style.display box1 = "block" } Variable is used cause I will have to use it more often later in the script.
HTML <div id="countermarker1"> <img src="countermarker.jpg" width="20" height="14" onmouseover = "countermarker1()"; /></div> CSS (know its not really relevant just to avoid questions about whether its right) #countermarker1box { height: auto; width: 80px; display: none; } JS and css is externally srced.
<button onClick="return popup('<span onClick='selectShape(1, 1, 1)'>test<span>');" tabindex=Ɖ' onFocus="setFocusColor(0,3)">....</button> This will work perfectly, but as soon as I need to pass Strings inside the selectShape function, I get stuck.
So the question is, how can I create the following and have it working
I have a VERY simple script to reload a page with fresh values when the value of a scroll menu changes. Trouble is, of course, NN 4.- freaks and closes the browser when this runs. No error warning, no error log?
I was trying to create JavaScript error handling for a form, and I was trying to get an error message to show up underneath the field where there was an error. (I am trying to avoid alert boxes.) I only have two fields, and my problem is that only one field is showing an error message. If I place an error in the input for the second field, the error shows up under the first field. How can I get the error messages to show up under the correct form field?
No matter what I put in here, Firefox is going into the error; will not return success.What the server returns is just plain text, no html, thinking maybe it has something to do with This, but I can't figure it out because there are only So many options for
I'm Matteo and i have some problem with my website with jquery on IE8 browser. In the site I have a filter bar, partially crated with jquery. The code is that: <div id='filter_area_icons'>
I'm trying to build a cascading menu in javascript I got as far as this ; all I want to do is Re-draw the whole page when the link is clicked however I get an object required message the second time the link is clicked (I,m using IE 5) Code:
I've noticed that when I click the Stop button on the browser, or navigate to another page, jQuery.ajax calls the error event. You can see the problem live at: [URL]..
I'm using jquery-1.3.2.min.js and everything works perfectly in browsers other than Explorer... It's not liking this part:
this.appendChild(E) function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})} ... } I get this error:Unexpected call to method or property access. jquery-1.3.2.min.js, line 12 character 2305
This error ONLY occurs in IE. "Unexpected call to method or property access." I pinpointed it to this line: o.appendChild(e);
The full function is: function aO(d, t, src, p, id ){ alert('aO has begun.'); var o, e, i; if (!ie){ o = cE('object');o.data = src; } else { o = cE('embed');o.src = src; } .....
I trying to make a call to an external domain using $.ajax() and it WORKS, the server receives the call, but the response in firebug errors out in jquery.js line 7760. I've been beating my head at this all day and don't feel like I've made it much further.
I suspect it has something to do with the dataType or type of the request. But I've tried all kinds of things from POST to GET to JSONP in the type. For dataType, I've also tried "html", "text", "xml", "json", and even some combos of "text html" but no success.