I need to create a variable out of nothing. From a database I extract an
item with a certain id. With this id I want to create a new variable.
For example:
id = 36;
"item"+id = new Array();
Now I get the message "Illegal left hand assignment".
I tried:
eval("item"+id) = new Array();
Is it possible to create a variable out of nothing?
I am trying to write a loop that will add 10 divs to the screen. Each div will have an onclick event. The function that will be called onclick requires a parameter. That parameter is dynamic based on the index of the loop. In Firefox this is no problem. However in IE I get some results that I wouldn't expect.
Here is my code:
for(var i = 0; i < 10; i++) { var linename = jsonObj.lines[i].line; var childcountid = jsonObj.lines[i].childcount; var lineid = jsonObj.lines[i].lineid;
var newdiv = document.createElement('div'); newdiv.setAttribute("id","main" + i); if (navigator.appName == "Microsoft Internet Explorer") { //************ this is the problem area ***************** newspan.attachEvent("onclick", function() {getCategories('main' + i)}); } else { newspan.setAttribute("onclick", "getCategories('main" + i + "')"); } document.getElementById('container').appendChild(n ewdiv); }
What happens is when the element is clicked the parameter being passed to getCategories is always 'main9' IE always grabs the current value of i, not the value of i at the stage of the loop that attachEvent was called.....
I'm creating dynamic buttons and forms for a website and would like the form hidden when it's corresponding button is clicked. However, when I pass button and form name variables to my JavaScript that hides the form, the variables are not being recognised unless I explicitly set them. (e.g 1 and 2 as seen below).
In a nutshell the onlick event doesn't seem to like PHP variables !
I have a little problem that doesn't seem to be working. I'm trying to access a variable using its string name which is passed when the function is called Code: ie:
// I would call this function like so... a("temp1", othercrap...);
The variable temp1 is set in another script file. I don't specifically know which variable I will be passing to the function a(), all I have is its string representation. I can access the values of temp1 if I specifically call it but I can't seem to figure out how to call it dynamically.
I'm working on a rather complex booking system for building European trips, in a combination of SQL/VBScript/Javascript. There are tons of query string variables that get passed back and forth between the pages, and in almost every case, I can set 'em up fine, provided the variables are in the link.
The page the *holds* the booking information, though, is problematic.
An example trip might include two European cities or towns with a week in each in an apartment or cottage that the user selects from a dozen or properties for each region.
All the information is on one page (all the dozen or so properties for each weeks, available dates for the trip and for each , max occupancy per property, pricing per property and per number of passengers, etc...everything necessary to actually book the trip). If the user changes party size or chooses a date, properties are hidden or shown depending on max occupancy and/or availability.
So, a user sets their date and party size (or maybe just the party size, or maybe has just cleared everything out to start over...) then wants to view available properties so they can find one they like. The current pax/date/etc. information is not in the query variables, because the link was built at runtime.
If I build the link in an onclick event, it breaks if someone right clicks to open a new page or tab.
I hate sites that disable right click menu. I hate sites where, when you open a new page with a right click, it generates a javascript error if the URL is created with an onclick event. I hate that using an onclick to bring up the page means whatever is showing in the status bar bears no resemblance to the page that is brought up when you click on the link.
My client isn't worried about the non-javascript people for this use; those people are referred to a free spiffy catalog, which frankly, is how most of this client's customers book their trip anyway. I just want to be able to carry the variables in such a way as to not break the site if someone right clicks.
I'm building up a RSS reader. In this app, the user will have the option to add and remove urls in a list. What I need is to create a new variable, everytime the user submit the form with the url. The variable must contain the url.
I am developing a site that adds multiple dynamic buttons. I would be ideal if the event these buttons trigger could pass a 'variable' (the passed variable is constant with respect to each button).
I am using ext js library to built ajax base site.I need to build dynamci variable and then send that variable with same name in paramter to phpi have following function where first i check the array length and then loop untill the array lenght come to end and within that i get the value from html.now i want to send dynamic variables as parameter but i can do this
Code: addvalue = function(){ var id_str=document.getElementById('array_chk').value;
I would like to display the number 1 at first and then 2. but this code produces number 2 for both alerts. I was able to achieve what i wanted with "new" constructor when creating functions but this is not a good practice and after all i am passing these functions as an event handlers and it can't be done with "new" keyword because it is throwing error. I think there are some solutions with arrays e.g the x would be an array of numbers, but i don't like it. Am i missing something important?
I have some JavaScript which is splitting out the different variable elements from the URL.Now, how do I set the internal variables?Then I want to set the variable ScriptHeading to be Change and the variable ScriptType to be NewThread.I keep finding all sorts of lovely code showing how to split out the various sections in many different ways, but I can't find anything on how to actually set these variables.
how to populate a dropdown based on Another dropdown selection. This all should be a dynamic. Eg: I have two text boxes one is TechID and other is JOB ID. When I start typing Tech ID it suggests me the list of IDs which start with the input string i have put in Tech textbox. When i select the Tech ID the jobs associated to that Tech ID should be displayed in JOB ID text box as a dropdown list.
I am having a problem with the last results. I can't seem to be able to get the input2A and input3A to appear. I don't seem to have a problem with the show and hide after a number is entered and submitted. If anyone can answer my problem I will be greatly appreciated with a prize. I actually have submitted it more than once and I haven't had anyone been able to answer it yet. Code:
i was trying for some days now to find a solution for this. had a look at different posts and forums online, but no luck so far...is it possible to auto-create this with a loop???:
I have a program written in Javascript and fully functioning which takes a user-selected directory name and then displays all the photos in that directory in a certain format.
I am now wanting to expand the program to allow users to optionally enter their own strings and the program will use all the photos from www.flickr.com which use that string as a tag.
I have a PHP interface to flickr (called PHPflickr) which collects all the relevant photo urls. I now need to get these images back into my Javascript so I can process them using the existing functions (rather than rewrite all my functions in PHP code and have two sets of functions in the program). I found on another thread a means to do this for a date variable:
but being completely new to PHP I'm not sure what "addslashes" might be or what formatting will be necessary if I am starting with an array of urls. Code:
I've been beating my head against a wall for a few days trying to get this working. I'm trying to create a dynamic menu where a user selects one item and another select list is shown, then another and another (and so on). Here is my JS, it *should* be taking the ID of the div, comparing it to the selected value and then showing another div by settings it's class property to visible:
I have made a script where you can add extra fields, and next to the row is a span that automatically displays the outcome from a calculation of three fields in that row. i.e. Q x (B - A) = total. Here is the bit that does the calculation:
function advCalc(selected) { var result = Number(document.formmain.elements["quantity"+selected].value) * (Number(document.formmain.elements["provideamount"+selected].value) - Number(document.formmain.elements["supplyamount"+selected].value)) ; [Code]....
I will like to know if there is anyway to view all the rules that I have currently in the Jquery validation plugin. Currently, I am trying to add in rules dynamically through the rules(add) function after adding some dynamic fields through the user inputs. the rules are added in this manner.
INTRO: I tried to clean it up for easy reading. I hope I didn't make any mistakes.
PROBLEM: WOW, this is some crazy sh!t. I can't get my checkbox (see "TAGSELECTED") to print my textboxes (see "TAG#") when more than 1 number (see "VLANS") is inputed into my form.
QUESTION: How do I make my dynamic form have a dynamic input box(which is created by checking the checkbox and calling the functionC1) inside it and still be able to pass the values to my php page? Code:
How can I then use this variable to access the opener of 'window' ?
Meaning, I dont want to access it as such:
window.opener
but as: window.+newVariable
So it uses the contents of newVariable to access the opener.
I need this because I have a couple of variables which I need to concat to eachother as a string, and this string in turn is the variable I need to access from window.opener.varSomething where varSomething is the variable that stores the variable I need to access.
I use ASP to obtain data from a database and I have a piece of javascript code I use on my website. I want to use the database variables in my javascript. I'm not very familiar with javascript, but here is some info similar to what I'm trying to do.
Not sure if php is the best solution or maybe javascript. ( or both.)
I am writing a litle script that will go to my mysql table and take out 20 rows ( from about 10,000 rows ) based on the WHERE statement.
Then I want to step through these 20 rows displaying just two filds in this fashion:
First, I want to display one field in a "box" ( using divs and css ) then wait for a form input. Then while keeping the first displayed box and field display the second field in a similar box a fee lines below. Wait for a form input update some data.
Then onto the next row.
If I use javascript then I could keep all the processing on one page and not have to have server refreshes.
But how do I get these those array elements from $row['field1'] and $row['field2'] into javascript vars ?
Is this the best way to do this ?
Or would php and having a couple of extra trips to the server for form processing be better ?
I would like to multiply combo_1 and combo_2 to give an outcome and display it in the textbox of txt_price using javascript. f['txt_price'].value = (f['combo_1'].value).toFixed(2);
This is something I was working on but no results so far. <form> <select name="combo0" id="combo_0" onChange="change(this);" style="width:200px;"> <option value="0">-select-</option> <option value="1">Canada</option> <option value="2">States</option> </select><BR><BR>
<!-- I would like to Multiply this field --> <select name="combo1" id="combo_1" onChange="change(this)" style="width:200px;"> <option value="1"></option> </select><label></label> <BR><BR> <!-- and this field --> <select name="combo2" id="combo_2" onChange="change(this);" style="width:200px;"> <option value="1"></option> </select> <BR><br> <!-- To present an outcome to this field --> <input type="text" name="txtPrice" id="txt_price" onChange="change(this);" style="width:200px;"> <BR></form>