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...
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.
...
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;
}
...
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)
...
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 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() {
...
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")...
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();
...
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(...
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...
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() {
...
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...
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'...
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 ,
...
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?
...
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() {
...
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 = ...