javascript

jquery ajax completion event

can someone show me how to make a jquery ajax completion event. $("#submit_js").click(function() { $.post( "user_submit.php", {comment: $("#comment").val(), aid: imgnum}, function(data){ /*alert(data);*/ }); }); when this POST request completes successfully, I want to show the message in a specifi...

jquery JSON php

while ($row = mysql_fetch_object($result)) { $data[] = $row; echo "<div id='captionbox' style='width: 110px;float:left;color:#FFF;text-align:center;'>"; echo "<a href='#' class='thumb'><img class='thumb-img' value = ".$row->aid." onclick='getVote(".$row->aid.", \"".$row->atitle."\")' src='images/roadies/th".$row->aid.".jpg' ...

Help me decode this javascript which generates a passsword based on a master password and a website's name

Hi all! There's a website that generates a password by joining a master password with the website's name (e.g. master password=abc and site=google) then hashing that with SHA1 and then coding the resulting hash with Base64. I've been trying to implement that in Bash, but I can't. I mean I can but my results are extremely different from t...

How do you include adsense javascript inside another javascript code.

How do I add adsense code to this javascript code. I think there might be a solution with jquery and getscript, but I'm not able to get it to work <script> var rep = $("#topbar").find(".reputation-score").text().replace(/,|\s/g,''); if (rep.match(/\d+k/i)) rep = rep.replace(/k/g, '') * 1000; if (rep == "") rep = 0; if (rep < 200 && $("#...

Remove mysterious <TextNode textContent="\n "> with javaScript

Hey, I've got a div with two children, one <h2> and one <ul>. My problem is that when I check .length of my div, by doing document.getElementById('wrap').childNodes.length, I get 5 instead of 2. And if I run console.log on 'childNodes' I get this: [<TextNode textContent="\n ">, h2, <TextNode textContent="\n ">, ul, <TextNode textCont...

HTML Page Caching Question

I understand the basics of HTML page caching. My uncertainty relates to how caching works on images, included external scripts, and included CSS stylesheets that the HTML page uses. For example, let's say I have an HTML page that is set to expire in 7 days. The page has 10 images on it, 2 included external CSS (.css) stylesheets, and 2...

How to generate a random number from scratch

How can a random number be generated from scratch, i.e without using any built-in features of the language / outside API that will help with the randomization process? For example php has a rand() function and a seed function, and I'm sure java also has some similar stuff. You can use built-in functions to get the current time etc, but...

How to stop event bubbling with jquery live?

Hi I am trying to stop some events but stopPropagation does not work with "live" so I am not sure what to do. I found this on their site. Live events do not bubble in the traditional manner and cannot be stopped using stopPropagation or stopImmediatePropagation. For example, take the case of two click events - one bound to...

current transform being applied by canvas

How can I determine the current transform that's being applied by an html5 canvas. It seems that it only supports two methods for dealing with transforms "transform", "setTransform" but I can't seem to discover the results of applying the transforms. Short of tracking them all myself and duplicating the the matrix mathematics that it m...

Is there a 4096 character limit for JavaScript XML text nodes?

How is it that I always get only the first 4096 chars of a valid XML text node? (using JavaScript...) is a text node limited? ...

JavaScript issue with Chrome

I'm not sure how this is Chrome specific, but it is. This is working on every other browser, including all IE* browsers etc. In fact, there's no code here that's client specific. All of this is being generated on the server. Yet after clearing Chrome's cache a million times and restarting it... the following doesn't work: <script type="...

How can I parse a URL called between pages in a frameset?

I have a 2-frame HTML page: FrameA contains a list of links to various pages, or anchors within pages FrameB displays the individual pages. Some of the pages contain slideDown sections, with trigger text - i.e. clicking this text shows/hides the slideDown section below it. The parent element of the trigger element also contains an ...

Crawling and parsing Javascript elements

Hello I try to get info from a website which uses Javascript to show onclick the phonenumber of the items/companies. Crawling that with PHP curl or xpath did not let me find a solution how to trigger this events and than keep on crawling. Example: <a onclick="show(2423,'../entries.php?eid=2423',1); for info here the function too ...

jquery: $(this) question

i want to call a function when i have a textfield focused and then unfocus it (whether i press TAB or click elsewhere with the mouse) and i used this code: $("#settings_view #my_profile_div input").focus(function() { $(this).blur(function() { change_my_profile(); }); }); when i first run it (have a fie...

How to start an AJAX request at a significant pause during user inputting using Jquery?

When a user is inputting something, I need to check user input against the corresponding data in database using AJAX, but I can't continuously check user input against the data in database because that would overwhelm my database server. I just want to start an AJAX request at a significant/obvious/sensible pause during user inputting. F...

Order of onclick and onselect javascript events

When a user clicks on a select control to select an option, do both the onclick and onselect events fire? If so, in what order? Is it browser-dependent? Thanks! ...

is there a library that sticks a zoom in/out button over an image and allows incremental + and -

is there any library or component that allows photoshop or pdf style zooming where i have images that i want users to be able to click to zoom in and out and i want to support being able to zoom in a number of times and zoom out a number of times i want the equivalent of every user having the ability to do stuff like this: https://addon...

Javascript: code behaves unexpectedly

Hello. I have a question relative to this code. It should (and it does) display a list of items, where you can add and remove entries by clicking on the plus and minus. <html><head><script src="http://www.google.com/jsapi"&gt;&lt;/script&gt; <script> google.load("jquery", "1.3.2"); app={}; app.attachList = function() { ...

Difference between dates in javascript

how to find difference between two dates ...

Custom color schemes for user logged in profiles

I this is a really general question, but what would be the best way to go about allowing users to customize the color of their logged in profile? Should I put css the inline? Nnd can I store the color values in something like a the session so they do not have to be looked up everytime? ...