this is a homework project which kind of works but isn't perfect. My tutor said the result must be an alert but I ended up with a document.write instead.He said it was fine but I'd like to know how to make it alert the result if anyone can help.FWIW I tried making the contents of the for loop into a variable without success.
What I'm trying to do just doesn't seem like it should be that difficult but I'm sure struggling with lacking skills I should say. I'm trying to automatically scroll a div up and down. For say if div.scrollTop = 0 then scroll to the bottom once it reaches the bottom scroll back up and so forth not stopping in a loop with say a timeout of 10.. Just need help putting it all together.
I've figured some stuff out: I can tell if I'm at the bottom of the scrollable area with: (document.getElementById(id).clientHeight + document.getElementById(id).scrollTop) - document.getElementById(id).scrollHeight
outputs lines of text, with two <br> between them. What I want is for if it's the last loop for that only to be one <br> but I can't figure out what that "last loop" code should be.
I think this one will appear in our finals but no one seems to help me.. always getting error.. a 3 radio buttons and will appear the result on alert or popup? something like YOU SELECTED: "___"
I've got the current script which returns 1 match in matches[0] with a url, but I need it to return ALL occurrences in the string.And then I need to know how to loop through the matches and display each "url" in this case.Nothing I've tried seems to find more than 1 match even when [string] contains a list of urls, which indicates I've done something wrong.
( THIS VALUE ARE CMG FROM DATABASE BASED ON THAT I NEED TO BUILT A TREE)
Here i need to biult a tree structrue concept like M1 (TREE) WHEN USER CLICK HERE
I ACTUALLY NEED TO WRITE A FOR LOOP FOR ACHEVING THIS TRIED ALL THINGS STILL NOT ABLE TO GET THE RESULT M5, M6 WILL BE LEAF NODE AS THEY DNT HAVE ANY VALUE IN COL2 AS THEY ARE LEAF NODE
Use code tags when posting your code. Code tags are used like so =>
I am just trying to figure out how to do some different things with the for...in loop and jQuery, but now I'm wondering if this is even possible. I made a simple example to test: function tellMeHeights(){ var allDivs = $.makeArray('div') for (mydiv in allDivs){ height = $(mydiv).css('height') alert(height) }} But this doesn't work - the alert box just says 'undefined'. Is it possible to iterate jQuery objects like this, or should I be using something else like .each?
I had some code that kept repeating itself over and over again, with the only variance being some named elements changing. All the named elements ended in a sequential number, so I figured I'd just put one of the repeating blocks into a "for" loop and then make that sequential number at the end of the named elements into the variable in the loop. Again, the code worked fine when copied/pasted over and over, but now it doesn't do anything. Here's one of the code snippets outside of the loop (which worked):
You can see there's an "alert" as the first part of the loop. That "alert" never shows up. However, if you comment out everything in the loop after the "alert", then the "alert" works. So something else in that loop is causing the whole thing to not work. I find it odd that the first "alert" wouldn't work, though, since it should be the first thing that happens before any of the other code is executed in the loop, right???
I have some problems about using jcarousel library on Google Map, and following is my scenario: there is a Marker on the Map, and when clicking on the Marker,Info-Window will pop up, and jcarousel content will be in the Info- Window And This is a simple demo:
I have a form which I need submit using ajax. I already got all the needed query from that form, but when I tried get the action address I got [object HTMLInputElement] instead of expected address blah.php.
Here is a quick example to demonstrate this behavior:
Code:
The problem is that I named the button as "action" and this.action is returning the button object instead of the action of the form.
I can't remove the form element with name "action" from that form because of the script that accepts the data, but I need get somehow the form's action (url).
Code: <script language="JavaScript"> var checkobj function agreesubmit(el){[code]....
i need to make it like if the button is clicked and there the agreement checkbox is not checked.. it should give an alert that the alert is not checked.. i know that would require a if and else statement but i cant figure out how to do it
i am facing a problem after using jquery jconfirm alert. Issue is that after receiving confirm alert, when user press tab to go on Cancel button and press Enter key there, despite of firing event of Cancel button, it fires the event of OK button. this issue is not produced when user press the cancel button by mouse. Waiting for your replies.
I have been looking at this code for two evenings now, and rewrote it 4 times already. It started out as jQuery code and now it's just concatenating strings together.
What I'm trying to do: Build a menu/outline using unordered lists from a multidimensional array.
What is happening: Inside the buildMenuHTML function, if I call buildMenuHTML, the for loop only happens once (i.e. only for 'i' having a value of '0'.) If I comment out the call to itself, it goes through the for loop all 3 times, but obviously the submenus are not created.
I'm looking to send a loop variable (i) to a function inside the loop, but I can't seem to get it to use the value I want, it keeps making it a reference of i and therefore the function is always called using the last value of i rather than the one it was set with.
So if i have 5 Tabs then Tab 1, when clicked, should call DefaultTabClick(0) and so on rather than always using 4 for any of the tabs.
I have the code below, how could it be modified to loop over and over and reload the xml file each time. Flow would be: load xml, run thruogh code to display each xml node one at a time, when reach last node, start all over, reloading xml file,
why does this work under FF and only ONCE in IE but the problem remains the same as the firefox only code crashed IE's javascript.so it works only once still.SOLUTION -> changed event from onchange to onclick for my checkbox calling that function !
I am trying to make an order form I am working on accessible for users who have javascript turned off in their browser, and to do this I would like to hide a div if JS is disabled.
Searching the Web has led me to think that styling the div to not display is the way forward and then using JS to display it. It is the JS bit I am struggling with! The div in question is a set of radio buttons to allow a purchaser to choose how many gift memberships they want to buy:
<div id="giftmember-buttons" style="display:none";> <h2 class="threepeaksform">How many gift memberships do you wish to purchase?</h2> <fieldset class="threepeaksform"> <legend>Please select the number of people you are buying a gift membership for using the buttons below.</legend> <div class="generalcontactform-group">
I'm trying to create a test using Javascript. Actually, I did this in PHP, but we need to put it a server that does nor run it, I think I can convert it to Javascript. I hope it'll be work as in PHP somehow. Test will be composed of 15 questions and each question has either "Yes" or "No" as answer. And, I use radio buttons here for answers. By the way, there will be more than one radio groups. Now, I want to check the value of clicked radio button in each group and use an if-statement to determine if it's correct. And, if it's correct, I want to increment a variable by 1. Finally, by the resulted variable incremented for each question in the test, I want to use another if-statement to show specific result message for and interval of that variable.
I'm new to javascript, and i'm having a problem. I want a button, which functions as a toggle, but also as a mouseover. When you click, under the button, a div opens with text. And when you mouse over, a shadow appears behind the button.I have two pieces of javascript, but i want both in my button. Can anybody help me?
I'm trying to add watch() to IE, and have more or less working code:[code]That works until I try to use setInterval with the code in red color. I never really tried OOP or prototyping in JS, so my whole approach to the problem might be wrong, but anyway, I think that if I execute that code in red every 100ms [for example], I'll be able to catch changes to properties on which the method is registered. Well, either my idea is wrong, or the execution.Some parts are commented out and method name is changed so that I could work in peace in FF.
I'm looking for a lightbox that allows me to have 3 lines of captions. Line one would be the art title, line two would be art dimensions, and line three would be media used. Would someone point me in the right direction? I have a lightbox that supports multiple lines, but doesn't allow for line breaks in the caption.