my webstie allows users to change the color of the background, so to keep the text readable I have it changing as well.the color picker I am using has text boxes with rgb values 0-255 for each.I am trying to get one bit of text to alternate between red and blue with the conditions
I'm trying to create a text field that, when two or more characters are entered, the form is automatically submitted. The trouble I'm having is knowing when the onSubmit handler is fired. It's supposed to be executed when the form is submitted. I'm doing a submit via JS which should cause the form to run the onSubmit handler. But, it isn't. This leads me to believe that calling submit() is different from a hard submit. True?
can anyone tell me why the second 'alert()' is not executed here? The first 'alert()' pops up (so I know I am inside the 'if'), but not the second one, and orderNum is not set....
<script type="text/javascript"> function LoadBlocks() { $(".LoadBlocks").click();
[Code]....
Like i said above when I call LoadBlocks function the click in executed in code behind but nothing else in the javascript function is beeing executed , not event an alert
i need to wrap the following code with (function($){ ... })(jQuery);But when i do so than the callbackfunction jsonpCallback will not be executed anymore.I hope someone can explain that to me...
// ( function($) {$(document).ready(function() { var error_container = $('#ul_demo_error')
I have a div with a click event that fires a show('slow')... however if the user clicks on the div multple times the animation plays that many times... is there a way to make it so that the click event is only executable once the animation is complete?.
I am experiencing some crazy stuff, at least crazy to me Both the 'if' and 'else' blocks (according to firebug) are being executed in the following anonymous function:
how I could use firebug to step through massive amounts of javascript that were written by someone else. I'm trying to figure something out for work which has me stumped.
An old co-worker wrote some scripts based on prototype to show input fields on a form when certain options were selected on the previous input fields. I'm trying to duplicate his old code but for some reason it's just not working. I can see that the reason those input fields aren't showing up is because display:none is being added on to the element by the js on the second step after the breakpoint (break on attribute change in firebug). This happens on the working page as well but the working page has about 10 more steps afterwards that eventually remove that style.
I am writing an extension to a third party application. this application generates code dynamically using insertAdjacentHTML(). I want to execute my function whenever the insertAdjacentHTML is called. Does insertAdjacentHTML() fire any event that i can handle and execute my function? or is there any other solution?
I'm trying to dynamically write out this line of javascript:
obj.offsetLeft
So I want to be able to feed a param of either Top or Left in and then write it out so it gets execuated correctly in the javascript....so i've tried stuff like:
I have some code that gets executed in a document onload event. I display an alert message box saying that some action was performed successfully.
However the following annoying issue is bothering me. Whenever someone bookmarks the page, or go back to it, or even refreshes it, then the onload event gets fired again and the alert box appears.
Is there a safe way to make sure that the code in onload will get executed only once? and that cosecutive triggering of the page will not trigger any code execution.
The most important thing to note, is that I pass a parameter in the URL indicating that the code should be triggered in the onload event.
Obviously when I refresh the screen, the parameter is passed again and the code gets executed..
The unexpected behavior-problem is that wherever the pointer moves between the the <li> elements (next or previous), the whole hide_menu() and show_menu() is executed as if the pointer got out of the div space and re-entered.
Using ajax and jquery I'm calling a function on the server code that returns a javascript script that I need to assign to a div and get executed automatically when assigned.So far I couldn't do that, seems that the assigned script to the innerHTML of the div can'r be executed dynamically.Basically I'd like something like assign an alert('hello world') to the innerHTML and automatically see the pop up with the message.
I am new to all this but making good progress and having fun in the process. I have written quite a bit over recent weeks (including a few $.post / $.ajax calls) for various sites/applications but this one is really puzzling me. Here is a snippet of code that is causing me problems.
[Code]....
The problem is that execution jumps from line 2 to line 6 ... ignoring the function(data) and I am not sure why. I get the correct value of "team" arriving at the perl script .... and the perl writes the correct json back. I just can't think where else I need to look to debug this - as I said, I have done something similar 5-6 times over the last few weeks - all without a problem. So I am sure I am doing something stupid here.
Im having some troubles with some functions i launch in $(document).ready() to initialize the page. Then if i click on browser refresh everything goes fine... even more strange when i place alerts between then calls to these functions everything goes fine too... but the first time the page is loaded it seems that the functions are not executed at all.
I am a self thought web developer and am constantly having problems making sure that certain commands are finished executing before others are started. My most recent problem is trying to append a large amount of data, to a div, then sliding it down slowly. Since that data takes a while to append, the system is doing both at the same time, therefore not giving me the slide down effect. Here is the code:
Where "SomeDiv" is part of "cpage" and "data" is a large amount of images. I would like to execute line 1 and then all the other lines simultaneously. It is currently executing all of the simultaneously.
In the following code - Sometimes I get the correct image width and sometimes I get an image width that is ZERO. How do I make sure the loaded image attributes are there before I access them. Odd thing is if I click the same thumbnail twice I always get the width. If I click a thumbnail once I may get the width this time BUT when I refresh I may get a ZERO width.
Here is the code... $(document).ready(function() { $('#gallery a').click(function(evt) { evt.preventDefault(); var oldImage = $('#photoBox img'); // Selects the current image var newImage = new Image(); // Create a new image var imagePath = $(this).attr('href'); // get the path to the image file to load that was clicked - via its href attr name newImage.src = imagePath;// Set the newIamge.src to file name or Path if (newImage.width < 600) // If the width is less than 600 calculate a new margin to center the new image { var newMargin = (620 - newImage.width) / 2; var newHtml = $('<img src="' + imagePath + '">'); $('#photoBox').css('margin-left',newMargin); $('#photoBox').css('width',newImage.width); } else // assume width is 600 { var newHtml = $('<img src="' + imagePath + '">'); $('#photoBox').css('width',newImage.width); $('#photoBox').css('margin',5); } newHtml.hide(); // hide the newHtml before prepending will fade it in oldImage.hide(); // hide the old image $('#photoBox').prepend(newHtml); // prepend the newHtml newHtml.fadeIn(1000,function() { }); // now fade it in });});
I am building a navigation which animates width on mouseover and revert it on mouseleave. That navigation also supports keypress/keydown actions, so it behaves like you hover with the mouse and additionally opens the submenu too. My problem is, when using the keydown (C) function, the menu opens up perfectly but when I mouseover then, it fires the 1. function and behaves like it should, it closes. I tried to stop that when just using keydown, but somehow I am stuck with it. Here comes the code:
Can a plugin stop some malicious scripts to be executed?
Say, i have my plugin installed in my browser. Can this plugin go through the html contet of the site and stop the execution of activeX, action scripts, flash, pdf anything like that?
I have an unordered list with each LI having an onclick event of "changeTabContent". When the page loads, I trigger the active LI's click. On a click, first thing I do is remove the previous results, which are a UL living under the "li.active" element. Next, I move the "active" class to the LI that was pushed and off the old one. Next, I add a loading animation to the screen. Next I append a new UL to the new "li.active" and use the load() method to insert a bunch of LI's from a different page. onSuccess, I remove the loading animation. [note 1] Next, you'll see a hack I added, more on that in a minute... Last two steps are to add a "more" link to the bottom of the returned li's, if a link was passed into the function, and finally I remove a handful of LI's (excluding more link) so there are only "x" on the screen.
My #1 problem is that the more link is not showing up at times, and the cleanList function is not removing LI's. I believe the problem is that with the load being async, sometimes those last two steps are being hit, but there is no LI's in the DOM yet. You can see I tried to run a hack so the while loop will execute when there is no "ul" yet. [note 1] - I tried to add the final two steps into the load() callback, but the LI's were NEVER loaded in the DOM when the callback function was executed.
I am trying to retrieve json data from the world bank's API, here's my code: <html> <head> <script src="[URL]"></script> <script type="text/javascript"> var theData; $(document).ready(function(){ $("button").click(function(){ $.ajax({ url: '[URL]', success: function(data) { /*this alert message does not show*/ alert(data); }, dataType: 'json' }); }); });
</script> </head> <body> <p></p> <button> Get World Bank Data </button> </body> The callback function is not executed but there is response when I checked it using firebug.