i got this javascript-function that changes the entries of a selectbo
depending from the selection of another selectbox:
function changeBezug(selectedEntry, '$exhibits', .....) {}
the string '$exhibits' holds all the entries for the option Entry i
the first selectbox;
Unfortunately i get javascript error unterminated string literal an
the error pointer points at the first apostroph:
function changeBezug(selectedEntry, '
I tried replacing all special chars in $exhibits, even putting th
string directly into the function code with php and tried using quote
instead..
Now im out of ideas!
Maybe im using the wrong replacement for the apostroph...
i use ' is that wrong? i also tried ' to no good either..
what's the right one?
I need to match two strings that have the same content, but out of order.
For example "hi, my name is will"
and "will hi, name is my"
So, in this case how do i check to see that everything in the top matches everything in the bottom?
Lets take this a step further. I ran into the problem that if the strings have quotes " they mess up. So i couldn't match id="yay" even though it was part of the string.
I tried to escape it , but for some reason it was escaped as %3D%quot%22% and the other similar string with quotes esacped as %3B%.
let me say up front that my experience with JavaScript and "Ajax" interactions has been horrific. There are weeks I will never get back because of it. Whenever I encounter something so horrific that it makes me blank my memories of the event, I find myself going back and trying to take different approaches to understanding what happens.
This current round of experiments involves sending and receiving what is effectively an associative array. That is, I want to send dom names and the associated values via XMLHttpRequest calls and on return, get a set of dom value pairs and push them back into the current environment in the browser.
what I need to figure out how to do is associate a series of DOM's with a button, extract the information when the button is pressed, and then present the entire array to a CGI. On return, I would need to take the same array from the CGI and transfer the contents into the specified DOM's
if this is not practical, tell me so and I go do something else which is probably more fun. If it is practical and has been implemented in some toolkit, fantastic. It saves me some pain. If it hasn't been implemented, well, there goes the more hours that I will never get back.
I have 2 fields for phone number.one is of size 3 and another is 7.After reaching maximum size for first field it automatically focus next field.I coded it as
I went to the PHP section of this site and posted this same question, but someone told me it's a javascript question. I'm trying to carry a string from one webpage to another. The user inputs some data on page 1, the info gets tested for certain elements, then gets sent to page 2. The problem is the strings aren't transferring and I don't know how to use sessions to transfer them. I need recipeNameEl, ingredientsEl, and descriptionsEl to be stored to a string and then transferred to the page the form's action="" attribute points to.
<script> function checkFields() { var recipeNameEl = document.getElementById( 'recipeName' );
I have a multiple select box and want to be able to select from this box and transfer the selection accross to a div using an "Add" button. I have this working fine but I want to append to the list, rather than replace the list when further selections are made.
I somehow need the function to remember the original selected array and then merge the new selected array and the old array if another sleection is made. This is all I have so far...
function editOptions(action) { var optionsBox = document.getElementById('optionsBox'); var selectedArray = new Array();
I've been learning javascript for about a week and I'm really struggling right now. This is a homework assignment to help in learning loops and arrays.
What I want to happen is when a form button is hit it will replace the array from the one previous instead of just adding to it. Hopefully that makes sense. What do I need to do? here's my code....
This does what I want; without the operator 'Number' I get a concatination of the various variables (as expected). Is there some way of globally defining all variables as numbers instead of strings?
ch = wiggy[2]; // ch will contain the character 'C'
however my JS book seems to insist that I do this:
ch = wiggy.charAt(2);
and indeed doesn't appear to mention the first method at all.
Since for my particular purpose I want to treat the string as an array of single characters, I prefer the first method rather than the second. Is there any reason not to pursue this approach?
I have two strings that I need to compare and modify when there is a matching value in the two. If strA = ??,' then I need to remove the value ??,' from strB and the new value would be strB = ??,12935'
strA = ??,'
strB = ??,12937,12935' (these could be any values in any order)
I want to write a reg exp that replaces strings matching "A anystring" or "An anystring" or "The anystring" with "anystring", basically removing the articles at the beginning of the strings. I got as far as this:
1) To populate a dropdown control that's on a page with data coming from the database, the developers concatenate all the values separated by a pipe character and pass the string to the JS function, which splits the string and adds the values to the dropdown control.
I think this is not a best practice b/c:
A) If the data returned from the database results in a string that's too long, it could exceed the limit of the JS string type and some items would be missing from the dropdown.
B) If by any chance, the data from the database contain pipe character, it would result in extra elements inserted in the dropdown control.
Is there a better way to pass data to JS w/o relying in strings? How can these practices be improved?
the title says it: is it ok to pass strings with spaces trough url? i tried it and it seems to work, but it also seems to me that more correct way to do it is to use '+' instead of space since that's what php get method does. i'm using window.location to redirect to another page.
I'm trying to convert a string based on the contents of another string. For example, I have two strings - "Purple" and "Orange" and a variable "P" - I want the script to look at the word "Purple" and everytime is sees the letter "P", assign this to a third variable (result variable) - if the letter it's looking at is not a "p", I want it to take that character from "Orange" and add it to the result string. So the result would be "Prapge". This is the code I have so far, and it doesn't work, absolutely stumped as to why ...
I have this code for HMTL5 Canvas, however this is a JavaScript directed question not a Canvas question.
<script type="text/javascript"> var c=document.getElementById("myCanvas"); var cxt=c.getContext("2d"); cxt.moveTo(0,400); cxt.lineTo(50,a); cxt.lineTo(100,b); cxt.lineTo(150,390); [Code]...
That will draw a line graph, however I want to get the coordinates from a variable in the URL. So it may be example.com/a=500&b=600 . How would I retrieve these two variables and then insert in to they're respective places?
I want a person to enter a string value in a javascript program.Example: Choose Rock, Paper, Scissors.Person: Rock.What is the code for a program to take in strings? Like parseInt andd parseFloat are for numbers. What is it for strings?