I have a function that takes the input from a text area, searches through the text, and should replace &, ", <, or > with &, <, etc. As the code is now, it will replace other characters, but runs into an infinite loop when dealing with ampersands.I'm thinking it's finding the ampersands from other things it has already replaced and trying to replace them over and over.how to improve this and break out of the loop?
Code:
<script language="javascript">
function replace(){[code].....
Here's a link to try it out, but the loop is infinite if you search for an & and may crash your browser.
The problem with the loop is that it's infinite, which I understand is generally not a very clever solution. In this particular case I would like to escape the loop with P20 and then link to a new page.
I am trying to do the following: I have written a simple programm that loops through an array of images when the user clicks a button. I have used a for loop to do this. The program works fine, however when I get to the end of the array, the condition created in the for loop is "true" therefore the button no longer changes the image. How do I start the loop again to create an infinite loop (i.e. every time the button is clicked, the image will change)?The script I have written is as follows:
var mySpheres=new Array("sphere.gif","sphere2.gif"); function changeSphere(){ mySphere=document.getElementById("sphere");[code]....
That's right folks, it's your favorite noob again. I am working on a popup calendar, and it is almost finished. The problem I am running into, is there seems to be an infinite llop somewhere in the cell creation. i have attached a snippet of the popup calendar as it currently is produced. As usual, I have spent the requisite 2 hours staring at my code. I found a few things, but I am now stumped.Here is my code, let me know what you see.
<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http:www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http:www.w3.org/1999/xhtml">
I have a problem of an infinite loop.The problem is found at:
http://truth-and-opinion.dyndns.org/BoR/
This page was created with minimal script, taken out of a larger more complex page.The body element is set with the onload attribute which calls a handler to initialize the content. In particular, I want to initialize the URL with a query substring: "?p=X" where X is a number from 1 to 10, corresponding to pseudo-page content. This is done by setting the page URL with the location.search property.But the problem with this appears to be that setting the location.search property causes another onload event, which then calls the initializing handler and sets location.search property again.
Setting a global such as locSearchInProgress to a boolean and testing if it is true within the initializng handler to cause it to return and thus to prevent execution of the location.search assignment statement is not helping.I have tried using .stopPropagation() and .preventDefault() methods while developing in FF, but have been unsuccessful.Is there a way to update the URL using a location.search assignment without triggering onload?
MORE INFO
What is a "pseudo-page"? There is actually only one HTML document (index.html), and it has ten DIV elements that are NOT displayed (CSS property "display:none"). After the user initiates a click event on the part of the document that is an interface for content / pseudo-page selection, any one of the DIV elements can be called using document.getElementById(), and its content put into a DIV that displays the content using a contentNode.replaceChild().Thus page navigation is script-based using hidden content fetched into a visible container.
I'm trying to create an endless animation similar to a screen saver, here an image floats around the screen, fading in and out. I would like to stay out of the global namespace, so I'd like to use the callback to animate() rather than getTimeout(), which seems to operate only on functions in the global namespace. Please correct me if I'm wrong about that. But I'm having trouble maintaining the scope I want for the callback I want "this" to refer to my Animation object, not the HTML element. I understand many folks have solved this problem for events by using bind() or live(), but I am wondering how to do this for animate().
In the end of world.bolt.cpath,there should be a way to use the local varis X and Y, and world.ground.js's world.ground.level[] to detect it. sorry for the gigantic length.
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:
My website has a flash animation I'd like to replace with a jQuery animation [URL]. I'm trying to create a dynamic statement to grab an array of words from an XML file and loop through replacing the word in a <span> with a random item. Would like it to loop continuously while the page is displayed. The HTML statement is:
<p style="text-align: center; font-size: 2em; font-weight: bold; margin: .5em,0,.5em,0;"> <span>Shred your </span><span id="indexShredItem">paper</span><span>, not your nerves.â„¢</span>
[Code]....
It works great once, but I can't get it to loop. I've tried "for" and "while" loops (no loop attempt is in the script above).
I need to open a new window(child) once the user clicks on the KPI(parent window) field on a Web page. I pass some parameters in the string. Problem is the KPI field can have the "&" ampersand character in it and the string thinks it is another parameter being sent. how I can get around this?
I have a form that has a text area to send data to a mysql database. the problem is when you type contents into the textarea and the contents happens to have an ampersand, everything after and including the ampersand gets truncated. I'm using ajax to store values from the form into MySQL
Ihave a list named'Geography', the list has a dropdown field called CountryDropDown, ID of this field is ID_CountryDropDown. This field is looking up to another list called LookUpCountry, which contains all the country names in the 'Title' Column.
Is there any was to prevent ampersand from splitting up the passed data? For example if my data looks like: "This is some text&blah blah" If I pass it as data it will get split up at "&": This is some text blah blah
I'm using ajax to store values from a form into MySQL. The form contains a text field named "title" and the method I'm using to fetch and pass on the data to the backend is shown below: _data = "title=" + $( '#title' ).val(); $.ajax({ async: true, type: "POST", url: "backend.php", dataType: "json", data: _data, success: function( json ) { .... } }});
The method works fine for normal text, say "This is a sample text". However, if an ampersand is used in the title text (example: "This & That"), the post value is being truncated at the ampersand. In effect, the & in it is causing the string to be split up into two segments and the part after the & is being treated as a variable, i.e. instead of passing title = This & That What is being passed is, title = This That = * as shown by Firebug
I want to create an web page with infinite x and y.
In web page user can add widgets , once widget added they can place it anywhere on the page , and when next time they login again we have to reposition every widget exactly what they originally had.
I'm starting with jQuery and all I want is like jCarousel, but I want that when mouse is over image, the entire carousel freezes (until mouse over). So, my first idea is to create something like this: <div class="photo" style="width: 256px; background-color: #8d99a2;" align="center"> <img class="photo_img" id="photo1" src="fotos/lookbook1.jpg"></div> <div class="photo" style="width: 256px; background-color: #8d99a2;" align="center"> <img class="photo_img" id="photo2" src="fotos/lookbook/2.jpg"></div> <div class="photo" style="width: 256px; background-color: #8d99a2;" align="center"> <img class="photo_img" id="photo3" src="fotos/lookbook/3.jpg"></div>
And Then, jQuery like this: $(".photo").animate({ "right": "+=9999999999" },{ duration: 200000000000, easing: 'linear' }); $(document).ready(function (){ $('.photo_img').mouseover(function(){ $('.photo').stop(); });});
The logic is that: -> a list of images that go to right eternally, (like jCarousel in infinite mode), but when mouse is over, everything stops. (JCarousel waits until the "next()" function is complete), and when mouse is out, everything moves starting from the point that paused.
I find that either of these plugins work in isolation but together they are clashing. The first to be specified in my initialisation code works, the following doesn't. Initialisation code looks like this:
I want to implement infinite scrolling in DataTables and data will be added to the table dynamically on table scroll. Initially all data are loaded in DataTables and display a sub-set of the data and when I start scroll in table its display normally. I am using normal SQL query to load all data available in my database table. How we write SQL query to get sub-set of data on scroll event and added in DataTables dynamically. I am using ASP.net (C#).
I've got an infinite jQuery carousel, which is working, however I need to make a couple of tweaks and I don't know where to start. Below is the code for a visually simplified, but technically identical version:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]"> <html xmlns="[URL]"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Page Title</title> <script src="[URL]" type="text/javascript"></script> <script type="text/javascript"> $.fn.infiniteCarousel = function () { function repeat(str, num) { return new Array( num + 1 ).join( str ); } .....
Basically, I'm trying to achieve two things: 1. The script creates empty carousel items; these are visible in yellow when you scroll through the items by clicking on the blue squares. How can I remove these so that item '6' goes straight back to item '1', without the two empty list items in between? 2. At the moment two clicks allow you to see all 6 'real' squares, plus the two empty yellow ones. How can I make it so that it scrolls one list item at a time, rather than 4 at present?
I want to use ajax to submit a dynamic form which can be filled with infinite elements. The only problem is passing all of the values of those elements through the ajax and onto my jsp page where they will be processed. Code: "promptIds=" + document.getElementsByName("promptId") That is one of the arrays that I send and I am using jsp, but in any case, how would I parse the array to be usable? Code: String promptIds = request.getParameter("promptIds"); System.out.println(promptIds); The above code outputs "[object HTMLCollection]". How would I go about parsing the array of elements?