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
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.
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
<script type="text/javascript"> var str="Welcome to Microsoft! Microsoft Microsoft"; var stringToBeFound = 'Microsoft' var ReplaceString = 'site' document.write(str.replace(stringToBeFound , ReplaceString )); </script>
My problem is im trying to use string.replace that is not case sensitive and replace every string found. I could use regular expression with it but my stringToBeFound is a dynamic variable im getting it from my database
i am trying to make an online graphing calculator with javascript. dont ask how because i dont know. but there is an annoying error in a do...while loop. although it should break out of the loop when the |'s (absolute value signs) are replaced with Math.abs( and ). here is the code.
I ran into a problem that I could not fix myself, I am trying to replace a string with another string, the replace lines look like this:
Code: var word = document.getElementById("word").innerHTML; document.getElementById("word").innerHTML = wordd.replace(/B/g, '<span class="style106">B</span><span class="style107"> </span>'); It works just perfectly if left alone, but I need to replace every letter inside this string, adding those style and span tags around each and every letter. So if I add another line to this code, like this:
Is is possible to strip out some legacy <br> tags and replace them with </p><p>? A line break after the closing para would also be nice. And, can I target the asterisk and following space (see below) and delete it?
I've had a look at jQuery and managed to replace the br with p tags but they're the wrong way round i.e. open then close as it just manipulates the DOM not my string.
The current code/text is supplied from a database I don't have access to and the client doesn't have the time (nor the inclination I would suspect) to amend it.
I'm looking for a very simple script to replace one div with another. I've found a few but they seem overly complicated with features I don't need. I simply want to be able to click on a div and for it to be replaced with another div previously hidden.
I've got a simple navigation system set up in a framed site: navigation/top frame and a main body frame. Whenever you click on a navigation button it passes the new location to this function:
In IE the page changes to Ƈ.7.htm'. In FF (and MZ) the page "flashes" but doesn't change. If I uncomment the alert the page changes. If I put the link in the nav frame the page changes in FF.
I see the use of Javascript replace all over the web. What are all the character sequences? (sorry I am a bit of a newbie at this).
i.value.replace(/[^d]+/g, '');
I understand that /g is global and /i is case sensitive, but what are the rest? I am asking because I am trying to write a function that takes an input and replaces everything but numbers and a . (for decimal numbers).
I am creating a "Please wait..." page to show a friendly message to my site users while the data is being loaded. I am using location.replace() javascript function to do this.
The problem that I am facing is displaying the records that the application has already processed on the wait page. Does anybody know what can I do to pass data field value from the end page where the data processing is going in background on to the wait page.
I found this in one of my old scripts but I can't remember what the -0 was used for. I remember it was a shortcut method but I can't remember for what. Does this ring a bell with anyone?
var Pattern = /px/; var T = paddingArry[0].replace(Pattern, "")-0;
What I want to do is add an onclick event handler to row1 to insert a row after row1. I can't seem to find a way to do it though. After creating the new row node, I could try something like document.getElementById("row1").parentNode.appendChild(newNode) but that would add the new row to the bottom of the table. The insertBefore() method is the right idea but I want to insert the new row AFTER row1 and there doesn't seem to be an insertAfter() method.
I thought about navigating through the DOM tree to get the row after row1 and then using insertBefore() but the table is generated dynamically and there won't necessarily be a next row.
I was tring to write a function to make that took the letters that a user is searching for and making the first occurrence of it bold in the results (ignoring the case).
>From reading javascript books and looking at posts in this group, I
thought this would work. Perhaps I misunderstood what $1 is. But in the results, I am getting a bold $1 with IE6.
How can I determine what the occurrence of the phrase is in the correct case?
I realize I can write this parsing the string without regular expressions but I thought this would be cleaner.
var match = new RegExp( escapeCharsForRegExp(typedLetters), "i"); if (match.test(text)) { text = text.replace(match, '<b>' + '$1' + '</b>' ); }
I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I supposed to write this function?
String.replace(/</g,'<');
2)
While I'm on the subject, anyone know why they implemented replace using a slash delimiter instead of quotes? I know it's how it's done in Perl but why is it done that way?
3)
One last regexp question: is it possible to do something like this: String.replace(/<(.*?)>(.*?)</$1>/ig,'<$1>$2</$1>'); This is just an example where a sub-match used in a regular expression must sub-match again exactly as it did the first time later in the same string. But I don't know how to do that in a regexp although it seems like it should be possible.
Basically the php gives the javascript a list of movies located in my directory, I am able to successfully launch any movie not containing a "space." I changed the code a little bit to allow for a "text input" and manually typed the name of a movie with %20 instead of a space and it worked. So I would like to modify the above code to do this automatically without visibly changing the movie titles. I am not sure where I should change the code.