I have a DOM click event that creates a <span>. When the user clicks a button, it turns that <span> into a textarea that the user can type a new name in, press enter, and then the span contains the text the user input. Sort of like when you rename a file in Windows Explorer.
Anyway, the code is something like this, and I'm wondering if I can use 'area_el' in this way... right now it's giving me the error that area_el is undefined, even though I define it in the function that contains the Event declaration.The first part is the Dom stuff to make it all work. It's not stuff I need to mess with, but I'm putting it here in case it's useful.
I am having trouble passing the correct id to change the innerHTML. I have a jsp that display people and their address information. There could be several people in the list, so it is in a loop. That part all works good. There is a drop down list with countries in them. Based on the country they select, I want to change some of the text. Here is what I have:
When I hardcoded the id= value, not matter which group I changed the country on, only the first one was changing, so I knew I needed unique ids for each group. There is more to the table, but this is the good part. When the onChange fires now, Nothing at all happens.
I have a function which is currently called twice on the same page. Part of the function is to apply an onkeyup event to a created element. The problem is that when the function is called twice the first created element calls the onkeyup function of the second element!
table_JD.length-1 = 0 for first element table_JD.length-1 = 1 for second element updateSearch_TC_JD(1) is somehow called from first element! newSearchBox.onkeyup = function() {updateSearch_TC_JD(table_JD.length-1)}
So this is my dilemma. I'm creating a function and passing variables dynamically, but when I try to pass a variable and then alert it out, I get an 'undefined' error.
Zeeshan Syed http://www.bdqworks.com var hotels = xml.getElementsByTagName("hotels")[index];
In this way the function works perfectly; but I want that Ifile is not equal to a predefined path BUT Ifile must accept the value of javascript variable ip_file
for (var i = 0; i < BS_crm['activityTypes'].length; i++) { var clickFunc = function(){ activityList.showForm( -1, {blockType:[""+BS_crm['activityTypes'][i]['id'], "0"]} ); }; var type = {
[Code]....
Now, basically what I am doing here is running through one array to create an array of objects, that will be used to create links that will use whatever onClick function I pass it. The problem is that on the second line I need the BS_crm['activityTypes'][i]['id'] to be a value, not a reference. If that line was simply changed to:
var clickFunc = function(){ activityList.showForm( -1, {blockType:["3", "0"]} ); };
if this is such a obvious question, but i'm kind of newbie in JQuery, i am using a lightpop plugin, & i want to pass 'image_path' via html. lightpop plugin code is something like this:
I'm trying to make it so when you click a cell in a table it runs a function based on the value within that cell. With the current code, no matter what cell is clicked, the alert box displays the same number, which is the last number in my array. The variable, princ, is just being overwritten rather than writing code to each the cell with the proper value.
I've been banging on this for a couple hours even though I'm sure it has a less-than-five-second fix. Hopefully somebody will glance at it and point out the obvious thing I'm missing.I'm using the onchange event of an html select element to trigger an array prototype function that looks for a value in an array and returns the indices of the array that contain that value, or FALSE if the array doesn't contain the value. For this example, here's the array being set up:
var instids = new Array(); instids[0] = 5; instids[1] = 6;
I'm using Keith Wood's jquery plugin to produce some graphs for my site. Though I've been able to produce "static" ones, I'd like the user to be able to input a new constant and then have my graph update it according to what they enter. I'm not quite sure how to add the value that the user inputs to my linear function below. So far I have:
I just want to know how can i pass the return value of a javascript function to a xsl variable.
I have an xsl file and from that file i will call a javascript function then the result will be stored in to the <xsl:variable> how will i do that? Or is it really possible to do that or is there other way of doing it?
I need to pass the 'id' variable from the event listener to the callback function, 'moveObject'. The moveObject function needs to know the id of which element it should act upon. How can I pass this variable?
I have a function in an external javascript file (calculate.js) which calculates the price of a product, based on a users preferences in a form (dropdowns, radio buttons etc). Each time the user modifies their choice, the script/function then displays the price on the page (index.html) using:
Once the user has finished making their choices, they then click the forms submit button (method="post") to be taken to a confirmation page (confirm.php).
Here, I can display the users preferences using php code like:
Every time i click on one of the said elements, it puts "undefined" into the textbox each time i click on an element.it seems to me that the Key_Table[x] is not getting passed correctly. How do i make sure that this is getting passed correctly?Here's my Code:
<script type='text/javascript'> // Startup Script if (document.addEventListener) {
I have a basic understanding of selecting elements and performing manipulations or effects, but I'm having real trouble grasping the basics of setting up variables, performing maths on variables and biggest of all, how you go about passing information from the HTML into a jquery function.
I have a site where clicking on any photo thumbnail brings up a full-screen lightbox to display the image full-size - I'm using the following to bring in the lightbox:
This works just fine, I also have no problem re-assigning the SRC of a blank image within the lightbox to make sure the correct image renders, my problem is I just don't know how to generate or pass information into this function to begin with to act as a reference point so the code knows what image it should be displaying based on which thumbnail was clicked.
I don't need anything particularly clever, even if each thumbnail simply had a numerical figure associated with it (eg "4") which gave the function something to work with once it was fired - that would be enough.
I know how to do all this in regular JavaScript but I have to admit I'm finding the documentation for jquery really hard work, I'm having real problems grasping the fact that the functions aren't being triggered directly by the HTML.
Another solution would be to get the src of the image that was clicked on, split the string and pull out just the filename (ie 5.jpg) and then prepend a path to it for the final full size image ( largeimage/ + 5.jpg).
I know there are probably pre-made scripts for this kind of thing but I'd like to try and avoid them if possible.
I can't seem to get a variable declared from within a post callback, so that I could manipulate my script accordingly. I have delete.php, that deletes an id from a mysql db. If it fails, I want the script to stop and display the error. The .php script echos an "ok" if everything went fine, if not - it echos the error.var abort_error; // set the error variable
Two objects on an html page. An event on object 1 effects object 2 $(".video_rg").mouseover(function(event){ var myTriggerId = event.target.id; var myTargetId = 'video_' + myTriggerId; document.getElementById(myTargetId).src = 'images/test_object_2.gif'; // this works // $('#myTargetId').src = 'images/test_object_2.gif'; // this does not }); My assumption (we know about those) is that I am not passing the data to the $() function correctly, that it is reading '#myTargetId' as a string, and not a variable. I just really want the JQuery code that would do what the document.getElementById code is doing.
var xf2; function f1() { if (document.createElement && document.body && document.body.appendChild) { xf2 = new f2(arguments[]); } } I am getting a syntax error in the "new" statement following the [].
How do I pass the variable-length arguments list received by f1 on to f2?
I have a list of most 17 recent entries from a db table and wanna use jquery/ajax to have a next button that loads the next 17 entries when you click it. It passes the 17 variable to the .load which works fine first time around (this is later used as mysql limit), but then I try to increase the start variable with 17 so that next time I click it would pass 34 to the .load (so it loads next 17 again) but this doesn't work, it simply loads same 17 again on 2nd, 3rd ect. click (so nothing changes). use global variables by setting it with var and using it without var inside the function.
<script> var start = 17; var loadUrl = '<?php echo site_url('welcome/battles'); ?>'; $("#latestbattlesnext").click(function () {
Code:I am having problems with the following. I am wanting to hide <tr> in my table (employees) and only show employees that are in the selected department (selected via dropdown box).I need to set a javascript array to a php array. I am looping and assigning the array and am wanting to pass a javascript variable as the index in php array. I have marked my problem lines in red. Thanx for any help.
<script type="text/javascript" > function display_elements() { var departments = new Array;
What I need to do, and it shouldn't be that difficult is this:page1.html - there is a yellow button and a red button - if the user clicks on the yellow button I want to set a cookie with the value "yel" then load the next page - if they click the red button set that cookie with the value "red"page2.html - 'onload' i want to read that cookie and load up the main image to match, something like this maybe?...
document.mainimage.src='img/main_' + variable + '.png'so that the path would be for example 'img/main_red.png'Any help please? Preferably javascript only and as simple as possible. If you think this would be easier sending that variable in the URL instead of as a cookie.