I have been struggling with a loop of mine. The loop should create a grid, of 204,000 squares(div's). And the total would create a grid field of 340 pixels by 600 pixels. All div's are sized 1 pixel.The idea is to create a grid, that shows temperature data in a gradient style, like a weather heat map. The data is collected from temperature sensors which are connected to a database.The only problem is that because it's such a massive amount of calculations to be calculated by javaScript, the whole thing freezes. Here is a sample of my code:
Code:
function makeGrid()
{
for (var i = 0; i < 8160; i++)
{
[code]....
Another problem is, the grid should be reloaded every 5 seconds or less.Because that's the interval used by the temp sensors, and for the usage that's planned for the project, its really important that the data is constantly up to date. using another web based language are welcome, as long as they are combinable with PHP or AJAX. Or maybe there is a ready to use library that I dont know of. Couldn't find anything for jQuery.
I am looking for creating a grid/table that is editable online. I have browsed online for solutions, but I am short of time & I seem to getting more confused the more I search.
Basically I am trying to create a staff rota that the admin staff can edit online and save out so it is viewable - but not editable by staff members.
I am to create a checkerboard which consists of an 8 by 8 grid of black and red squares in which no two squares of the same color are adjacent. Write a graphics program that displays a checkerboard.
When I compile this I receive an error Checkerboardwindow.java:14: 'class' or 'interface' expected Checkerboardwindow.java:18: 'class' or 'interface' expected
The first coding is my CheckerboardWindow and the second coding is Checkerboard...
I am creating a grid of thumbnails. When a user hovers over a thumbnail, the image enlarges. The *trick* is, I want the "active area" to only be the size of the thumbnail. That is, the thumbnails are 180x120, and when the mouse leaves that area, I want the large image to shrink back to normal size.
I have a working demo here:[url]
The way I accomplished this feels hacky though, and I's like to know if there's a simpler/more elegant way to accomplish it. The thumbs are an unordered list of images.
Here is my javascript:
In essence, I add an overlay div over each thumbnail which acts as the trigger to shrink the enlarged image. I thought I could use the parent <li>, as it doesn't appear to expand with the image (since I've set its size in my CSS) but that didn't work.
I have a question for flexigrid jquery grid control users.
I am able to display json data returned from my WCF service in my Flexigrid in my application.
The paging toolbar displays correctly and it's clear that the paging toolbar understands how I've configured it.
However, the grid is not actually implementing the paging filter on the data in the grid. For example, the paging toolbar says "Displaying 1 to 10 of 12 items". However, all 12 items are displayed in the grid.
I guess I'm missing a config setting or callback. Any idea what the problem might be?
The idea here is to have a function in javascript that would take the value from one input box (lets call it txbA) and use it as the limit for a while loop or for-next loop and create a series of input boxes each with a unique name so that its value (when entered or changed)could later be used in other calculations.
When I try something like:
function MakeMany() { var y=parseInt(txbA.value); for(var x=0;x<y;x++)
[Code]....
You can call this from a button and get the text boxes, but how do I get them to have unique names such as MMtb1, MMtb2, MMtb3 etc. ??
i was assigned this task(see attached), but for some reason I'm having trouble getting it to work, i don't know if my problem is in the algorithm or if I'm using the wrong structures to solve the problem.
I am trying to create a function that creates an array comprised of filenames based on a given range. I.E if 2-8 is selected and a foldername of UMCP/ and a common name of college is also given, the function should return and array such as [UMCP/college2.jpg,UMCP/college3.jpg.....UMCP/college8.jpg]. Here is what I've got but the alert that should tell me the filename of the first image says it is undefined, how can i fix this?
function getArrayPhotosNames (total,count,first,last) { /*window.alert("get Array Photo Names");*/ var folderName = document.getElementById("photofold").value; var Alias = document.getElementById("commonName").value;
On my form i have multiple select which all have an id value total1, total2, total3 etc so i am trying to detect how many there are and then use this to caculate a total.
Is there a javascript reference to basically go to a form and produce a loop which will show me how many select drop down boxes there on a form.
Or would i have t use something like
for (var i=0; i < frm.elements.length; ++i) { form.elements.length form_field = frm.elements[i]
and then have a nested if to detect if it is select value or has an matching value ..
I am trying to create a simple HTML table with the squares of numbers and for some reason the loop is not triggering.
Code:
<table border="1"> <tr><td><h2>Table of Squares</h2></td></tr> <tr><td> Number
[Code]....
When I run the page all that comes up is the start of the table that is written before the script executes. Also is there any way I could use a debugger to catch this on my own? I tried the firefox debugger but it didn't catch anything when I ran it through, maybe I was just doing it wrong.
I have several elements that I can perform show hide and fadeIn animations on but I want the action to continue on an endless loop. Is this possible? If it is, are there any cpu usage issues when using a loop? <script type="text/javascript"> $(document).ready(function(){ $(".upright").hide(300); $(".cntrlg").show(300); $(".cntrlg").hide(300); $(".cntrmed").show(500); $(".cntrmed").hide(300); $(".cntrlg, .lowleftmed").show(100); $(".cntrlg, .lowleftmed").hide(100); $(".lowrightmed").show(300); $(".lowrightmed").hide(300); $(".cntrmed").show(300); $(".cntrmed").hide(300); $(".upright").show(2000); $("#dai1").fadeIn(3000); $("#dai2").fadeIn(3000); $("#dai3").fadeIn(3000); $("#june1").fadeIn(3000); $("#june2").fadeIn(3000); $("#june3").fadeIn(3000); }); </script>
I have a following problem: from time to time an attack on my page is performed, overloading the server. The administrators had to limit the access to the page to some domains only. I would like to keep the page open for everybody.
Probably I should introduce a JavaScript/CGI driven form and let user to copy some letters etd. before letting him entering the page.
I am sure there are many solutions to this problem around, but I don't know what to search for. Can you give me some tips where to start?
I think the attacs are just casual, there are no real reasons why should anybody try to copy or destroy the page (no commerece, no money to loose or gain), so probably I should start with something simple.
I'm programming a function that breaks a massive string (2 million + characters) into "manageable" chunks of 500,000 characters. The function goes as follows [code]...
As you can see, everything should work fine, and the function should return a stringified json array (which would be parsed and sent to a server) but the loop stops after the first interval. When I decrease the length of "v" using substr to 5 characters, the loop works fine. What could the problem be?
I have been using jQuery for only a few weeks now, replacing all of my standard js in a massive Intranet PHP application with lovely and space-saving jQuery. However, I've been using FF to write and test code while the company standard is IE6. Nothing works in IE6 - nada, zip, zilch. It bugs out on the very first call to the js file and wants me to begin debugging. Am I correct in assuming that I'm going to have to go back to regular js? I'd love to get the company to upgrade to IE7 - I've not seen ANY complaints about IE7 and jQuery.
This is my first post while learning Javascript and jQuery as total noob.
I have something like this:
var desc = "This is your title and here is even more that might be added so that we can get at least 60 characters or so"[code]...
It is actually being used on a page that calls a description from a MySQL table, but this example fails in exactly the same manner. Although FF and other browsers successfully initiate the script with errors, but IE loops endlessly and freezes up. FireBug reports "reference to undefined property a[d]". Using jQuery 1.6.2.
I'm building a simple corporate site (temp on my server) for a friend's company and am having an issue with an animation I have implemented. everything has worked fine for me (mac, firefox and safari) but my friend sent me a couple screenshots of the animation freezing on his computer (safari) when it is only halfway complete. the two examples are:
[Code]...
the code seems perfectly fine to me, and I am having no problem with any of it.. does anybody have an idea of what might be causing this? or is nobody seeing the animation freezing?
I am looking for a single jquery plugin that can sort the table and also freeze the column headers and works in IE, FF and Chrome. I have found tablesorter plug-in that works great for sorting and fxHeader that works great for freezing column headers, but when I use both of them together there are issues. My table structure is something like this.
I have two grids, they both display buttons. One grid displays numbers, true or false and yes or no, and the other grid displays letters, true, false, yes and no.
The second grid is not displayed in the code (used css to not display second grid buttons (.answerBtns)) Now using the getButtons() function, if the user selects button "1" in first grid (the grid which you have to open using (Open Grid) link, then it should display button "A" in second grid, if user selects button "2" in first grid, then it should displays buttons "A" and "B" in second grid, if "3" then display "A", "B" and "C" and so on.
Now except using if statements and stating which buttons should be displayed and not displayed depending on the button chosen in first grid, is there a more efficent way of coding this so that the display of buttons in second grid depends on what is selected in the first grid?
If it is using an array can somebody show a sample of this in their answer. You can just do it for one example and then I should be able to use that to fill it for the other buttons.
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.
<script language="JavaScript"><!-- /*RESIZABLE DOM GRID - (C) COPYRIGHTED DON WATSON 2003 ALL RIGHT RESERVED - DONWATS@USA.COM*/ function mouseevent(elm, _event, _function) { elm.attachEvent(_event, _function) }
function mousedetach(elm, _event, _function) { elm.detachEvent(_event, _function) }
function resizeGrid() { var srcElem = event.srcElement;
/*lets get the rule (css)*/ ruleNum = expandingTD.firstChild.className; /*assume its the span*/ ruleNum = ruleNum.substr(ruleNum.length-1,1);/*strip the num off the end*/
var _head = document.getElementsByTagName('head').item(0);
var dss = document.createElement("STYLE"); dss.id = "rowspans"; _head.appendChild(dss);
var _table = document.getElementById("grid"); var _tr = _table.getElementsByTagName("TR")[0]; var _td = _tr.getElementsByTagName("TD"); var colnum = 0;
Should work on IE5.5+ and recent Mozilla clones. Download size ~30K Open source (GPL license) Not released yet, no API documentation (will be soon)
Basically the question is - does it make sense at all? What's your current experience with client-side widgets - too slow, too heavy or there is still a place for things like that?