javascript-events

JQuery UI Click call works on local machine but not when published to server - also using CakePHP

I have some javascript that looks like this: $('.resultitem').click(function(event){ alert('check this gets called'); location.href='viewinfo/'+$(this).attr('rel'); }); this code works fine on my local machine but after uploading to the server it doesn't seem to get called at all. Can anybody help me un...

help understanding dean edwards addevent javascript

I need help understanding this piece of code. What is the point of handler.guid? Why is there a need for a hash table??? What is the point of if ( element["on" + type]){ handlers[0] = element["on" + type]; } What doe sthe "this" refer to in handleEvent? The elemnt? or the the addEvent function. ...

Why is javascript sending an element to my event handler, when that element has no event?

This html: <span id="mySpan"><img src="images/picture.png" alt="Some nice alt text" /> Link text</span> This javascript takes the span containing the image and text, then makes it clickable: spanVar = document.getElementById("mySpan"); spanVar.addEventListener("click", myEvent, false); function myEvent(e){ var obj = e.target; } ...

Synchronizing loading js files with ajax calls and loading js files with <script> tag

Dear all, consider this: core.js: var core = { all:{}, load: function(jsUrl) { $.ajaxStup({async, false}); $.getScript(jsUrl); }, init: function () { $.getJSON('someurl', function(data) { for(key in this.all) ...

Hrefs vs JavaScript onclick (with regard to Unobtrusive JavaScript)

What is best practice with regard to using links/<a> tags with explicit hrefs to other pages in your site (i.e. href="/blah/blah/blah.html) vs having hrefs/divs/etc. that don't have an explicit href and have their onclick set within the document ready handler with JavaScript in say a main.js file. I'm not an expert when it comes to web ...

Why the "focusin" event handler isn't called ?

Why in the following code the focusin event handler isn't called ? HTML: <div id='wrapper'></div> <div id='button'>Click Here</div> <div id='output'></div> JS: $(function() { $('input').live('focusin', function() { $('#output').html('focusin'); // Why this not happens ? }); $('#button').click(function() { ...

javascript help required

i am using the following code snippet to fetch element with a particular id but it kind of messes up at times... Does anyone have a better code...? or fix for this? function getData(html,id){ var curSectionId = id; var subStr=html.substring(html.indexOf("id=\""+curSectionId+"\""),html.length-1); var divsStrs=subStr.split("<div")...

How to unhide multiple inputs using jquery.

Hi, I have form where user can choose to enter more than one option. I currently show one input field and hide the remaining 4 input fields for that option. Previously, I used link under each input to unhide the next input and link. $(function(){ $(".show").click(function () { $(this).parent().next("div").show(); ...

Javascript submit() event is not fired up on exit (unload event)

I got page where HTML elements <form> and <iframe> are dinamicaly created with Javascript: document.write('<iframe id="myIframe" name="myIframe" src="about:blank" style="display:none;"></iframe>'); document.write('<form id="myForm" name="myForm" method="post" target="myIframe" action="myURL.php" style="display:none;">'); document.write(...

Using Javascript, how can I force my user to log out before going to a new domain?

I have a website (written in PHP) that my users need to log into, and I want to be sure that they log out when they're done. So, I have a JavaScript method that deletes the PHP session cookies, and I want to call that method (a) right before the user either closes the browser window (i.e., the DOM Window object) or (b) points their brows...

Need help with mouseOut effect

Ok so the following code produces a mask on a web page when hovering over a menu, my question is how do I edit this code to make the mask go away with mouseout event? As it sits now I have to click for the mask to go away. Any help is appreciated, thank you. <script> $(function() { $("#menuwrapper").mouseover(function() { ...

crossbrower window onload method with javascript

Hello, with Javascript, I'm wondering what's the current best way to load my code onto the page (without jQuery) after the rest of the page has been loaded. So like a window.onload... I was looking at several options but they all seem outdated and not-completely cross-browser friendly. Does this look like it would be best? It does...

PhoneGap Alert Notification firing multiple times

I've implemented the notification alert in an iphone project using phonegap. I've tried the direct, quick, and full examples listed on their api page: http://docs.phonegap.com/phonegap_notification_notification.md.html The problem is that when the event fires, it fires multiple times. Twice on iphone 3gs, and 3 times on iphone 3g. I'...

How to block others access javascript

Possible Duplicate: Protecting client side logic & data Hi , How to block other reading my java script through view source, My thing is, now one can access my java script, bcoz am not sure, but just guess some one from outside using some tool to changing my javascript events, So how to make the autenticated , ...

Javascripts works for chrome,in IE it does not work

in a php file: <script type="text/javascript"> function click(input){ img = new Image(); img.src = '/click.php?id=' +input; } </script> <a href="http://www.out.com" target="_blank" onclick="click('IDinmysql')" >outlink</a> click.php updates mysql after I click this link it works for chrome,but not for IE,what is the problem? ...

How to call a function with jquery blur UNLESS clicking on a link?

I have a small jquery script: $('.field').blur(function() { $(this).next().children().hide(); }); The children that is hidden contains some links. This makes it impossible to click the links (because they get hidden). What is an appropriate solution to this? this is as close as I have gotten: $('.field').blur(function() { ...

Webkit transitionEnd event grouping

I have a HTML element to which I have attached a webkitTransitionEnd event. function transEnd(event) { alert( "Finished transition!" ); } var node = document.getElementById('node'); node.addEventListener( 'webkitTransitionEnd', transEnd, false ); Then I proceed to change its CSS left and top properties like: node.style.left = ...