Gets Xml But When It Loops It Empty The Page
Nov 30, 2011
I'm making a page which gets the contents of an xml file and creates a table and populates it. The problem is when it loops around it seems to strip everything from the page HTML, HEAD, BODY tags and everything inside of those and just puts the value of the elements from the xml file onto the page. My question is, am I able to perform this loop and keep the rest of the contents of the page intact? I've been trying for most of the day and I can't get this working.
[Code]...
View 1 Replies
ADVERTISEMENT
Dec 11, 2006
I'm using Drip 0.5 to test for a memory leak in some code. After reducing
the page down bit by bit to find the leak, I ended up with an empty page
that still leaked!
The page source is exactly this:
<html>
<head><title></title></head>
<body></body>
</html>
It doesn't leak the same amount each page load - sometimes it's 8192,
sometimes it's 16384, sometimes even reducing the memory load. But the
overall trend is an upward movement. I let it run for 10 minutes and it
leaked almost 10MB, so it's about 1MB/min.
This is not a serious leak, but it's making it harder to know if a leak is
caused by the js code or this other thing going on.
Has anyone else run into this? Any ideas what the problem is? I've shut down
all processes, removed all IE add-ons, etc, but no change.
View 1 Replies
View Related
Nov 24, 2011
I have two radio buttons in my form. Now what I found out is that in firefox, if you refresh the form, is a radio button was selected before the refresh, then after the refresh the radio button is still selected. I want to know is there a way by using javascript code to be able to say no radio buttons should be already selected when page reloads or refreshes or does it all depend on browser?
I tried including in the window.onload=function()
btnRadioO[0].checked==false && btnRadioO[1].checked==false
which I thought would do the trick but it didn't work.
[Code]...
View 1 Replies
View Related
Nov 24, 2011
I have two radio buttons in my form. Now what I found out is that in firefox, if you refresh the form, is a radio button was selected before the refresh, then after the refresh the radio button is still selected. I want to know is there a way by using javascript code to be able to say no radio buttons should be already selected when page reloads or refreshes or does it all depend on browser?
View 5 Replies
View Related
Dec 14, 2009
I have a form and in the form is a checkbox use as a switch to hide and unhide a two textbox. When the other textbox is hide, the other is unhide such as the code below. When the user click the submit button on the first time and there is an error, it reloads and the id="fieldset.-in_honor" hide because it is set to hide initially but not empty. My problem is, I want to show the fieldset whichever is not empty after submit button is click and there is an error so user will not enter any more information to the other field. Is that possible?
/*toggle switch*/
<p><input type="checkbox" name="in_honor" value="" id="checkmemoriam" onclick="showHide(this.name);" />Please check to make this donation in honor of someone special.</p>
/*hide textbox but unhide when the switch is on or the checbox is check*/
<fieldset id="fieldset-in_honor" class="fieldgroup" style="display:none">
<legend class="hide">In Honor Of</legend>
<p>To make this donation in honor of someone special, please complete the two fields below:</p>
<div class="formfield" <?php echo highlight('donate_honor_name'); ?>>
<label for="donate_honor_name">Name:</label>
<input id="donate_honor_name" name="donate_honor_name" class="text" type="text" value="<?php safeEcho($form['donate_honor_name'])?>" />
<?php helper_error('donate_honor_name'); ?>
</div>
<div class="formfield" <?php echo highlight('donate_honor_acknowledgement'); ?>>
<label for="donate_honor_acknowledgement">Acknowledgement should be sent to:</label>
<textarea id="donate_honor_acknowledgement" name="donate_honor_acknowledgement"><?php safeEcho($form['donate_honor_acknowledgement'])?>
View 2 Replies
View Related
Nov 4, 2007
i am trying to do but I have no clue how to write it. Im trying to write a while loop that prints out all of the multiples of 5 between 10 and 95. I just need to know how to write the while loop i got everything else.
View 1 Replies
View Related
Feb 6, 2006
I'm my script I've three loops processing a very huge data file. IE & Firefox show a message box after some time saying my script could be infinite looping and give me a chance to stop it.
Is there a way to prevent this dialog box to show up? I'm writing a script used only on a intranet and the final customer should not see the message box.
View 6 Replies
View Related
Jan 12, 2007
Hi, I want to have something like this:
function callme1() {
alert('somestuff');
}
function callme2() {
alert('somestuff');
}
function callme3() {
alert('somestuff');
}
function callme4() {
alert('somestuff');
}
etc.
except, it's going to be created in a loop, like
var x=0;
while (x<10) {
function callme[x]() {
alert('somestuff');
}
x++
}
So, out of that I would like to get 10 callme(1-10 or A-J) functions...
I guess I am lost which way to build this with the placement & parsing
of the variables.
View 3 Replies
View Related
Jun 6, 2009
Is it possible, when you have a loop in a loop, that when the inner loop reaches a certain point, it breaks out of both loops? For example:
[Code]....
The code above will break out of the (b=0;b<=10;b++) loop when b==5, but it will continue to do the a loop. not putting the first loop at all or making the first loop stop at 1): Is there a way to break out of both loops when the if condition is met? (I only ask that you not give a work-around because what I have in mind is much more complicated than this)
View 3 Replies
View Related
Dec 15, 2007
i'm scratching my head over achieving similar results with setInterval() function, and how I can keep it from looping infinitely.
I want to do something like this:
var i = 0;
var endTime = now + ((1000*60)*2); // 2 minutes after now
while (now <=endTime) {
i = i + 1;
now = new Date().getTime();
}
document.write("total iterations: " + i);
however you can't do this because of lag issues, so i'll settle for using setinterval on its smallest interval of a millisecond, here is my attempt to translate the above to a setinterval solution:
var endTime = now + ((1000*60)*2); // 2 minutes after now
var intervalID = setInterval(loopFunc(endTime),1);
function loopFunc(endTime,intervalID) {
if (new Date().getTime() <= endTime) {
i = i + 1;
} else {
clearInterval(intervalID);
}}
as you can see I have prolbems figuring out how to stop the interval from continuing to iterate, and passing the interval id, I'm clueless Also I'm clueless on echoing the total iterations via this method.
View 4 Replies
View Related
Nov 8, 2009
I want to get averages from a for loop. Let's say I had a # of exams and in that loop I wanted to add the exams up and calculate the average. How would I go about doing this? Is this even possible in a for loop?
View 1 Replies
View Related
Jul 26, 2009
If I were to have a script:
Code JavaScript:
var numbers = [1, 2, 3, 4, 5];
var incrementer = 0;
while (incrementer < numbers.length)
{
[Code]...
View 1 Replies
View Related
Jul 20, 2005
I have got a span inside a td of a table. i am trying to clip the
string that exceeds the length of the td and then put three dots
("...") after it so it will show that the text was clipped and when
the mouse hovers above it, it will show the title. now i have managed
to do all the above by puting a span inside the td with the style
overflow:hidden and it all works fine. to add the three dots i have to
clip the string to ten pixels below the length of the td and then add
the dots. i can do it by slicing the string in "string.length-1" each
time and then get the new length of the string with offsetWidth, and
when getting to the right length - add the dots. the problem is that
the slicing is done in a "while" loop, and when having a very long
table it takes too much time. the question is if there is any methods
of clipping the string by pixels or any other method that will shorten
the run time of the script.
p.s.
i tried also having another span with the three dots that is
display:none and when the length exceeds the span length (the length
of the span is set to the td-10px) i change the display to block, but
the second span keeps on droping a line which is not good for me.
View 3 Replies
View Related
Nov 21, 2009
I really can't figure out why it's not working in IE. The only problem I can think of would be using nested loops. Here's the part of the code that isn't working. It's not generating an error, it's just not returning anything. I know you guys hate when I post entire code, so I trimmed it down as much as I can. It's referring to an already stated xml document with xmlDoc. And it's goal is to return a table of rows that meet certain criteria. If you can see any syntax errors that explorer would not like, that's really what I'm asking for.
[Code]...
View 6 Replies
View Related
Nov 29, 2005
I would like to have two buttons on the page. When visitor clicks on first, I would like to start looping through numbers for example from 1 to 100. When loop gets to the end, I would like to start it over and stop it when user click on the next button.
My concern is if this is safe. What if user waits for 1 minute or more to click the second button which should stop the loop and pick up the number where it currenly is? Will it cause browser to warn user that the script is slowing down the browser? How can I avoid this?
View 11 Replies
View Related
Jul 11, 2010
While arr[i] works fine in a loop, the addition of another dimension...arr[0][i]...means that it will not accept an assigned value.
View 12 Replies
View Related
Aug 16, 2010
point out where my logic is flawed in this? Or where my scripting is wrong?I'm trying to build a standard HTML table with 5 columns across and as many rows down as necessary, to fit all of the images in an array (brought into the DOM via PHP).My goal is to have rows of 5 columns that add on to accomodate up to 50 total images (10 rows).Here's my logic (flawed or not):*Look at the number of tems in the array*If the number is greater than 5, build one full row (of 5 <td>s)*Check again - is the number of items in the array greater than 10?*Build another row*If not, build a partial row, and fill in the rest of the <td>s (less than a full row) with blank spaces.The question is whether or not my logic is being represented in the javascript?unctions in <head>calls to function on lines 149-159Don't mind the formatting, I've blown it up so I can see what's going on.
View 4 Replies
View Related
Dec 6, 2011
I want to start of by saying, i dont know much when it comes to javascript. I am trying to set variables up and call them in 2 while loops (one to set the variable, one later to try to call for it since I am putting it in an array) as I dont know how many I will be using when this code runs. To help understand what needs to be accomplihsed, I have commented out code on what I need to do, and left code beside it on what the sample is that actually works. I hope this is clear on what needs done.
HTML Code:
<script type="text/javascript">
var long_array=new Array();
[code]....
View 5 Replies
View Related
Jun 25, 2010
I am having trouble with a project i am supposed to be doing which is to turn structured English into coding joined with the code i am about to post !This is the code i have written so far that works:
var contestantNamesArray = ['Tom and Nazia', 'Pat and Dan', 'Sandra and Kofi', 'Ian and Adele', 'Paul and Costas'];
var judgesPointsArray = [2,1,5,4,3];[code].....
I have tried myself but i am stuck at how to link the contestantNamesArray with the rest of the code in order to be able to display the couples who scored the maximum points and store it in a new variable and then write out the names.
View 10 Replies
View Related
Nov 28, 2010
We have created this function with loops and arrays Problem is the loops work only when I take out the function when the function is in place, nothing works, it is part of exercise
here is my code
title>Congressional Races</title>
<link href="results.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="votes.js"></script>
<script type="text/javascript">
[Code]...
View 5 Replies
View Related
Oct 26, 2011
I've now got to form an average of snowfall inputs, taken from looped prompts, however I'm not allowed to use arrays or functions...Almost every example I see uses arrays, such as this one here:http://www.codingforums.com/showthread.php?t=4313Is it possible to not use arrays to form the average? Please describe how to do this in general terms, as was highlighted in that link ^^^ I want to learn, not copy, although one can be derived from the other...What I haveso far, assume all vars have been announced.
for (var d=1; d<=numofinputs; d=d+1)
{
input = prompt("Enter a data input" + d)
}
View 4 Replies
View Related
Oct 26, 2009
I am trying to make a hollow square for loops this is what i got but i dont want my loop to go infinite i just want my loop to stop after first time.
<html>
<head>
<script type="text/javascript">
var squareSize;
[Code].....
View 8 Replies
View Related
Feb 27, 2010
I have to create a pyramid with nested for loops in javascript. This wasn't a problem until my professor asked us to mirror the pyramid. this is the code i have so far:
<script>
This part of the program works. What I'm having trouble with, is placing spaces and x's on the left side so that the triangle appears like:
I saw a few thread that had the right half of this triangle upside down, but I couldn't figure out how to flip it and fill in the other side. I'll attach the .html file so people can run what I have so far.
View 1 Replies
View Related
Dec 5, 2010
We have to create a number guessing game with a random number between 1 and 50. With a loop that runs exactly 10 times or until you get the number and gives hints that say guess higher or lower. I don't know what I am doing wrong this wont work at all. I am generally lost?
lab14a_KENTDL.html (3.48K)
Number of downloads: 52
View 1 Replies
View Related
Nov 14, 2000
I've been working on trying to compile this bit of Java code. It's taken from an existing code (with permission) that I know works. The problems started when I added an array. Code:
View 6 Replies
View Related
Oct 16, 2011
Write a script to generate two random numbers for variable m and n, the values generated for the variables should range from 1 to 10. We want to make an m * n table (m rows and n columns) with the word Hello in each of its cells. Now define a function f with one parameter n that displays n columns of one row of the table (You need a for-loop). Call this function m times to display m rows of the table. For example if m = 6 and n = 4 we should get the following:
HelloHelloHelloHello
HelloHelloHelloHello
HelloHelloHelloHello
[code]....
(The above is supposed to be a table but did not copy fully)This was my attempt, although i really did not know how to attack this.
<script type="text/javascript">
function f(n)
{
[code]...
View 4 Replies
View Related