I am finding some unusual behavior with techniques I am using to
show/hide/update data without having to refresh the page. I'm quite
sure it's developer ignorance on my part and would be grateful for any
suggestions.
My page has 10 tables with their visibility controlled by the user
making a menu selection. For example, selecting menu_1 calls a
function which displays table_1 by setting table_1's style display:
block and hides tables 2-10 by setting their respective styles to
display: none. Everything in this simple navigational approach works
as expected.
I am also using the HTTPRequest object to update relevant objects on
the page based on user input. The problem I am seeing is when the
HTTPRequest object is used to update DOM objects contained within the
"invisible" tables -- or more accurately within those tables having
their style display:none. I have tried using both the HTTPRequest
object's synchronous and asynchronous approach and am seeing the same
results.
I've tested when all of the tables are "visible" by setting their style
settings to display:block and HTTPRequest calls work as expected.
The other twist in my example is that these HTTPRequest calls are each
making a SQL query and updating a chart object within the table, which
may take about 500ms each to return. My initial impression is that it
looks as if the page is being rendered too fast because any more than
three charts on a page is when the charts start getting misplaced on
the page. Again, everything works fine when all tables are visible.
Is this a known problem with HTTPRequest, or do I need to migrate my
coding techniques to the 21th century?
I have the following object: var wDefaults = { "skin":1, "pagewidth":"960px", "c1col":[ {"wid":"w001","pcol":0,"wpos":0,"wclosed":"false","wcollapsed":"true"} ], "c3col":[ {"wid":"w002","pcol":0,"wpos":0,"wclosed":"false","wcollapsed":"false"}, {"wid":"w003","pcol":0,"wpos":1,"wclosed":"false","wcollapsed":"false"}, {"wid":"w004","pcol":0,"wpos":2,"wclosed":"false","wcollapsed":"false"}, {"wid":"w005","pcol":1,"wpos":0,"wclosed":"false","wcollapsed":"false"}, {"wid":"w006","pcol":1,"wpos":1,"wclosed":"false","wcollapsed":"false"}, {"wid":"w007","pcol":1,"wpos":2,"wclosed":"false","wcollapsed":"false"}, {"wid":"w008","pcol":1,"wpos":3,"wclosed":"false","wcollapsed":"false"}, {"wid":"w009","pcol":2,"wpos":0,"wclosed":"false","wcollapsed":"false"}, {"wid":"w010","pcol":2,"wpos":1,"wclosed":"false","wcollapsed":"false"}, {"wid":"w011","pcol":2,"wpos":2,"wclosed":"false","wcollapsed":"false"} ]}
First, how do I access a single value? I've tried some of the examples I saw on the forum, but nothing happened. The alert did not fire: alert(wDefaults.c3col[0].wid); //first try alert(wDefaults.c3col.0.wid); //second try var obj = wDefaults.c3col[0]; //third try alert(obj.wid);
The nested objects are the properties for widgets within a portal. After the user moves around the widgets, I need to update the object, putting the widgets in a different order within c3col and updating the values saved in pcol, wpos, wclosed, & wcollapsed. I also may need to add or delete an object, for example, delete wid=w003 and add a new one called w012.
My logic would be: for each widget on the page found = false find the object in c3col where wid == x and update its other values . set found = true if found == false then add a new object to c3col with x & its properties end for for each object in c3col if that wid isn't found in the list of widgets on the page, delete it from c3col end for sort the objects under c3col by pcol and then wpos
The red parts are the ones I'm unclear about how to do it. My basic questions are: (1) How do you access a single nested object? (an object within c3col, find and change its values) (2) How do you add a new nested object to an existing object? (add a new object to c3col) (3) How do you delete an nested object? (remove an object from c3col) (4) How do you sort nested objects? (sort the objects in c3col by pcol and wpos)
I have a page that has a a two part div system bioTop (top div) and bioBot(bottom div). The bioBot is hidden (.hide()) and shows with the click of the more text. Also there is clickable text to change the text in the divs from english to spanish and vice versa. The click for the top divs work just fine. The issue presents its self when the english or spanish text is clicked the bottom div does not take the new information or the text int the bottom div does not change. Can a hidden div have new information loaded into it. The page that the action is on is oncalllegal. The jquery for the english and spanish text is.
what i want this to do is take the x_cityid and add it to teh hidden field with the id of citiesid (I will do an ajax call before this but my simple javascript is not working)what am i doing wrong?
function addtocitylist() { var x_cityid = document.getElementById('x_cityid'); var x_areaid = document.getElementById('x_areaid');
Can anyone tell me the best way to access a hidden object in a form? I could use a hard-coded index to the elements of the form, but it's too easy to add something before the hidden object and mess up the indexing. For example:
The form has a tagid of "myForm" The hidden object has a tagId of "myHiddenObj"
I can get the form elements by using var formElements = document.getElementById('myForm').elements
But there doesn't seem to be any way to do this: document.getElementById('myHiddenObj')
Assuming I have the elements as obtained above, none of these have worked for me either:
I use an HttpRequest in my web application to launch an heavy computation server side. The result is then send back to the browser. The problem I got is that when the computation took too much time, then I never get the result. I have to reload the page to get it.
I assume it's because my socket connection has time out, but my event listener does not seems to get any event. Maybe I miss something:
function xmlhttpChange() { // looking fo a xmlhttp "loaded" for (var i in nodeId2xmlHttp) { if ((nodeId2xmlHttp[i] != null) && nodeId2xmlHttp[i].readyState == 4) { if (nodeId2xmlHttp[i].status==200) { nodeId2xmlHttp[i] = null; } else { alert("Problem retrieving XML data (nodeId: " + i + ")"); nodeId2xmlHttp[i] = null; } } } }
My question is : how to handle XMLHttpRequest timeout. Any pointers?
I've created a page that uses HTTPRequest to include some XML data and allow the user to update that data. The problem is that the new data doesn't show up, even though the XML file is changed.
I can call the XML file up in a separate browser window, where I get the old data, refresh to get the new data, then when I refresh the first browser, the new data appears on the page.
I'm thinking this might be some sort of server caching issue. Has anyone else run into this? Does anyone have a solution?
When I click on a field, I put the object position in a variableEnviro["lastfocus"] = $(event.target);I call the action and a block of HTML arrived on the page, I place this text and then after, i want the focus to return to the field and I do this:
I'm trying to run a php query via ajax httprequest. In my php script I have query result. I am also creating a txt file and link to the file. The query result then becomes the link to the file like so:
[Code]...
where $counter[0] is the result of the query. How do I access $Link from the httprequest result so I end up with something like this:
first, i put the object on a variableEnviro["lastfocus"] = $(event.target);after that i do an action and the data come back from the httpRequestthen I do that$(Enviro["lastfocus"][0]).focus();But nothhing append, no error bot no result.
Is there a way in Javascript or Jquery to return an array of all objects underneath a certain point, ie. the mouse position. Basically, I have a series of images which link to various web pages but I have a large semi transparent image positioned over the top of the other images. I want to find the href of the background image that the mouse pointer clicks over.
I am using the Microsoft.XMLHTTP object to make server requests ie; ajax. This is working 99% of the time but occasionally it will freeze at the server for 5 minutes and then raise a javascript exception "Unknown name".
After the exception I can run the same request ok, and keep doing so until the next time it freezes for 5 minutes.
What does the "Unknown name" javascript exception mean?
Why does it freeze for 5 minutes?
I can't replicate this on my dev pc, it's only happening in a live environment with IE6 and 2 load balanced IIS6 servers.
I am trying to get a simple set of Javascript tabs to work properly. I have just two tabs and I want to set up the script to have the second tab automatically hidden prior to reading the javascript code because right now it shows the contents of both tabs when the page is loading and then the second tab disappears after all the script has loaded.
I have the jquery script linked to on the page and here is the way my script looks to run the tabs:
Code:
I want to add something like style="visibility:hidden;" to the DIV that isn't shown on page load and have it added and removed as necessary when users click on the tabs. So basically I would like the generated code to look like this:
Specifically, assume I have a div tag of absolute dimensions. I need to figure out, first, whether or not the text inside the div tag is partially hidden by the overflow setting, and if so, what the hidden text is.
Is this even possible? Obviously, the rendering engine in the browser "knows" this information, but is it accessible through Javascript?
I was wondering if anybody could help me out a little. My goal is to update some information about a system every 2-5 seconds. The information needs to be displayed in some sort of table, but the size of the table needs to be able to shrink and grow. The main problem here is updating the table without refreshing the entire page and making any clicking noises. I was thinking maybe I can put the table in an iframe and use javascript somehow to update the iframe whenever neccesary.
I have <div id ="changeable"> with some html in it. I have a link that calls the function to replace the info in the div. The problem is that the "creative_development.inc" file is added to the top of the div and does not replace the content. How do I replace the content, and not just add content?
I'm creating a simple auto updating script based on PHP and using jQuery to set the interval to 1000 miliseconds. It works in FireFox, as the only one I've tested so far, but in Internet Explorer (Version 7 right now, didn't test others) it just freezes and doesn't auto update. Doesn't auto update either if I refresh the page, so something's messed up here.I'm using the same way of auto updating on other things, such as a chat-page - works on those in all browsers, so I'm kinda on a lost track here.
Here's the JavaScript/jQuery: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
I've not done much in the way of JS, if really anything other than using javascript.com before, so this may be me bieng quite m00bish, but I am having problems with my script on a page.
In a nutshell, the script I have currently allows my viewers to make a selection from a drop-down list, and as a result, the embedded WMP object below starts streaming the selected video.
WMP gets the video name from the VALUE= element of each list item.
My aim is that as well as the page starting the selected video, that a paragraph of text will appear under the WMP object based on the selection showing information regarding that video.
I've tried playing with a VAR element, and then using document.write to print the variable name to the screen, but this only writes the value of the variable at the time of page loading, and does not refresh.
What I am trying to do is assign a value to unchecked checkboxes. To do this I am running a function upon the submission of a form that checks the boxes for a value, and if they are not checked, assigns a value to them. I though I had it working, but for some reason I am getting a syntax error with the line that contains the "else"
My code is as below. The form name is deleterows and the form is dynamic so there can be any number of checkboxes (hence the for loop). Code:
I'm trying to make a physics program and have run into some trouble when i tried to update the div element by using the document.getElementById("target").innerHTML=c command, its in a loop and is supposed to update through every increment of the loop, but rather it only updates when it reaches the end of the loop. Here's the code:
I have a slideshow that also has links to allow the user to pick which slide they want to go to. That works okay for the most part, but once the user has selected a slide the slideshow continues to run, which I want to happen, but it continues to the next slide from when the loop function ran initially instead of the next slide in the show from the current slide. I tried recalling the function from the link function, but that really didn't do anything. I realize...at least I think that I realize that the function needs to be rerun from the new value of the count variable, but everything that I've tried to make it do that has been a colossal fail.Again I'm a novice here and this has to be written in plain javascript, otherwise I'd have gotten this done via jquery in probably 3 lines of code.
I've made a simple ajax script that's supposed to update a captcha image. The only part that doesn't work is where the new image replaces the old one on the page. The problem is that they both have the same source name which means that if I just update the image src, or the innerHTML of the div surrounding it, nothing happens, since the image src is the same and so would the innerHTML be.
I'm using jQuery 1.3.4 right now, and I have the problem where .css is not updating the style information of two items:The code below produces the underlined lines of output. The red parts show where I expect my calls to .css to update the values, and I do not see updated values. I've added '//FAIL' after the lines that aren't doing what I expect them to do, and also highlighted them in red.nyone have an idea what I might be doing wrong, or what might be causing this?
Element X (701.4833374023438) Y (284.41668701171875) W H cont(PM_MENU 499.48333740234375 217.06666564941406 200 47 itc() 501.48333740234375 284.41668701171875 200 13 INITIAL submenu (PM_BC_MENU) 86.58332824707031
I have a program that via an html form asks the user for information. When the user clicks submit a function is run that checks the values, if the values aren't of the correct type (nan etc) then an alert box pops up. If not then it proceeds to the results.
My problem is that the values of the fields in the form are picked up when the submit button is first pressed but when I correct the field errors and press submit again, it throws up the same errors in the alert box.
So how come the first time I press submit it gets the updated values of the variables (which contain the form values) but the second time it doesn't and I have to refresh??