I am experience some problems reading a form variable from a Javascript function. The point with this particular variable is that its name has the following syntax:
<input name="tx_impexp[tt_content:159]"/>
I want to set this var to 1 from my javascript function, so I tried to execute the following line of code:
Error: missing ] in index expression document.frm_1.tx_impexp[exclude][tt_content:159].value=1 --------------------------------------------------------------|
It seems Javascript expects to close down the bracket at the position marked...An easy solution would be to change my var syntax but the point is that I cannot since I am using an already made script and I should not modify it.
Just wandering if this is due to a syntax error defined according to Javascript specification language or there is something wrong with this.
I'm passing a variable to a selector. I have found a few resources and tried to implement them but they're just not working for me. I am trying to find href that match my variable and am working with the following:
var itemLink = /site/Mario-Kart..etc. $("a[href=" + itemLink + "]").......etc.
I receive an error "Uncaught Syntax Error unrecognized expression: [href=/site/Mario-Kart..etc. ]" I have been placing the quotes in different places to correct the syntax but to no avail. Also, this works with JQuery v1.44 and earlier but not after.
I had a look at sIFR.js code after parsing it and I have a question about function syntax. For example
var f=function(){ // statements here }();
What is the purpose if the second set of parentheses following the closing brace? Is the intention to execute the function immediately after it has been defined?
Most functions in sIFR.js do not have this syntax, but a few do.
just a quick question about syntax.What's the difference between the following functions?
$("#menu li").hover( function(event) { if ($(this).is(".active")) return;
[code]...
If you notice, at the end of the first hover function, there is an excess (), whereas on the second, there isn't. They are both functional. I was just curious as to why this is added sometimes and other times not.
My Javascript is very limited, but I get on pretty well with Jquery (I love it!) so some of what I say here may be seriously flawed I've done alot of searching on this but not found anything that fits what I need (I'd rather write and understand my own code than use a plugin) What a want is a simple function (or other means) of replicating the callback function for lengthy animations (so I don't end up with a load of functions within functions within functions) So I want to be able to animate (or change) a multiple number of elements IN TURN - ie once the previous animation has completed - eg
I know I can do this with callbacks, but as I said, this gets messy Can I stick these in an array and pass to a function to manage this (and if so how baring in mind my limited Javascript
I am trying to declare a variable inside a function and use it later on in my code... but it just already returns white space... i.e. not variable value. I am setting it within this function:
function show_video1(){ document.getElementById('video1').style.display="block"; var video1Name = "Education World News (Part 1)"; document.getElementById('video2').style.display="none"; document.getElementById('video3').style.display="none"; document.getElementById('video4').style.display="none"; [Code]...
and trying to call it later on with this: <script type="text/javascript">document.write(video1Name)</script> It might be worth noting that each one of my 11 videos will hace a different name.
i'm a newbie on jquery i'm studying it with the latest version, and following a book called "Learning Jquery" but iencountered a error, and i don't know what the problem is:
i copied the code from the book like this:$('a[@href^="mailto:"]').addClass('mailto'); to try to change the links which start with "mailto" to the new class "mailto" but there's a error reported: uncaught exception: Syntax error, unrecognized expression: [@href^="mailto:"]
Sorry but I can't get the very first tutorial to work. I put the custom.js in a test_jr directory in htdocs. I also put the starterkit.html file in the same directory. I copied the contents of jquery-1.4.4.min.js into a jquery.js file also in the same directory. Then I did the custom.js page shown here:
I tried clicking on the [URL] and I get the starterkit.html page. If I click on the "some link" it doesn't do anything. What am I missing? There are syntax errors in my editor starting on the line with the asterisks* Why is there an error there? It looks like it closes the click function?
so i wrote this slider with some help from an admin, everything works as I would like it to but I'm trying to make it a plugin so i need to tighten up a certain part of the code:
(function( $ ){ $.fn.jmSlider = function() { // get total width of all li elements in the slider var wrapWidth = 0;
[code]....
what i would like to do is instead of using "li:first" and "li:last", i would like to use first-child and last-child so the element doesn't need to be a li, in can be anything that is the direct child of the parent container.
So I've got this checkbox thing going on, where an array converted with the value of each checkbox in it.It looks like this:
[Code]...
What I want out of this function is the variable newworkdays to use in another function.
How do I access the "newworkdays" outside the function? I've already try to declare the variable outside of the function, though that resulted in that I didn't get the value of the variable inside the function.
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"]} ); };
How do I acess the whitelist variable from outside the sendrequest() function?
Iv tried saving it to a window.var variable with no luck. Iv tried creating a div and assigning it's innerHTML as the whitelist variable and getting it later with no luck. The fact that it's a chrome extension complicates things because i dont actually know if i can create elements from where the script is located.
I am currently working on a code that has a function within it called findHighestValueIndex which will find the highest value in an array. The problem I am having is writing this function so i can call it in the program to work on 2 different arrays. I already have it working on the array assesmentScoresArray, but I also need it to work on the weightedScoresArray. Is it actually possible to do this or do i need to write another function that is almost the same but with the arguments etc for the other array? I will paste the code below so you can see where I am up to. I am a novice in programming so im probably going about this all the wrong way
Im trying to set the value of a variable with a function, the variable i want changed is defined in another variable.
Then later i have this:
The "Selected" var is the var i want to change, and the value of it will change every time one is changed (it's for a calculator) When i try it though, it changes the value of the "selected" var it'self and not the var that i want changed. how i can i got it to change the value of the value of selected and not the selected var it'self?
Heres what i got, ignore all the unknowns they come from textboxes etc.
My problem is in this function I change the value of a variable. I want to store that variable change so i can use it in another function. Heres what i got.
function setupGame(){ var guessesLeft = guessNo.value = 10; var wordSplice = new Array(); wordVal = word.value wordVal = wordVal.toLowerCase(); alert(wordVal); for(var i=0; i<wordVal.length; i++){ wordSplice[i] = wordVal.substring(i, i+1); wordSoFar.value += "*" }}
Thats the first function, the variable or 'Array' values of wordSplice I saved I want to use in this function :
function runCoreEngine(){ for(i in wordSplice){ } }
How I would modify the following function to get it to check if a url variable is present and if so to add it into the string variable for the url.
Code:
If my url is index.php?make=Apolo then I need to get this added into the var queryString part of the function so that the ajax returns the correct values.
I have a .js file that receives a value from an html page. I'd like this value to be a global variable that all functions in the .js file can use. I have tried just declaring a var at the top of my .js file, but when the value comes into the function and gets assigned to that variable, it is not global.