Hi folks,
I'm trying to store a reference of an HTML tag for later reuse.
e.g. If I click on a div and save a pointer to that div within Javascript, will there be a way I could serialize such pointer? So I could de-serialize it and use the pointer in another instance of the web application?
Only methods I can think of are the follow...
<form id="form1" method = "post">
Text1:<input type ="text" id="textname1"/><br>
<input type ="button" name="button2" id="button2" value="UPDATE">
</form>
<script type ="text/javascript">
$(document).ready(function() {
$("#button2").click(function(e){
alert($("#textname1").attr('value').replace('-',''));
...
http://davzy.com/gameA/
I can't figure out a smart way to get gravity. Now with this it detects which block the character is over but it does't drop to that block!
Is there a better way to do gravity? I'd like to do this without a game library.
...
Hi,
I'm using $.grep() to pull back a set of JSON results like so:
myObject.appJSON = jQuery.grep(myObject.appJSON, function (a) {
return a.category == "Entertainment";
});
and it works fine. But what I really want to do eventually is have several checkboxes so that that I can filter on several different things. I real...
Possible Duplicate:
Performing Inheritance in Javascript
What are the ways to implement inheritance in JavaScript Which one is the best and why?
...
I have a DOM element C which is a descendant of DOM element A. There are several layers between them, one of which is an class of element named B.
If I have jQuery("#A") and jQuery("#C), how can I find the parent element of C with class B, which is also a descendant of A?
If I use parents() of C then I could potentially get any elemen...
While looking through a 3rd party JavaScript API and example code I noticed the following declaration. Basically XML assigned to a string but they seem to split it up on multiple lines using '\', I was unaware this could be done in javascript. Could anyone provide some more details on how this works?
Thanks.
var PrimaryChannel = '<Chan...
Hello,
what I am trying to do is to force some arbitrary JavaScript code to execute "inside" a DOM element, e.g. <div>. In other words, is it possible to make a piece of code "thinking" that <div> is the root of document hierarchy (or <body> of a document)?
Real life example:
Let's say we have a page that allows executing JavaScript ...
I'm using the following regular expression in my code to validate option symbols:
^([A-Za-z]{1,5}\d? +\b(?<=^.{6}))[0-9]{6}[CcPp][0-9]{8}$
If you notice, I'm using a negative lookbehind assertion to confirm that the previous match was only 6 characters.
However, JScript Regex apparently doesn't support lookbehinds but it does support...
I’ve written an HTML5 application for iPad. It has one input field. Every time a user comes to this page, the popup keyboard appears.
How can I suppress this default behavior within HTML5/JS context?
In my app, if you type in a login & password, it shows another screen (without page reload). But the keyboard still exists, and you have ...
I'm having trouble figuring out how to access object properties in Javascript. I have a function that returns an object, and I can see that object and all of its properties when it is logged to the console in Safari, but I can't get the property values for other functions. For example trying to alert out one of the properties returns '...
I've been following the lessons about transparency and gradients on mozillas site https://developer.mozilla.org/en/Canvas_tutorial/Applying_styles_and_colors but I have not been able to figure this one out.
I know I can achieve these effects with a png image; however, in the program I am working on the gradient will chance constantly ac...
Is running something like:
document.body.innerHTML = document.body.innerHTML.replace('old value', 'new value')
dangerous?
I'm worried that maybe some browsers might screw up the whole page, and since this is JS code that will be placed on sites out of my control, who might get visited by who knows what browsers I'm a little worried.
...
iterating over an array, am printing some div content for each iteration.
Whenever the user clicks on any div content, a popup should appear and should show the corresponding content in the popup from the array.
below is my code,
foreach ($email as $client)
{
echo "<div class = 't'> Show more....... </div>";
...
hi, i have this code
function showLocation(address) {
geocoder.getLocations(address, addAddressToMap);
}
function addAddressToMap(response) {
// map.clearOverlays();
if (!response || response.Status.code != 200) {
alert("Sorry, we were unable to geocode your address");
} else {
place = response.Placema...
All,
I have a PHP5 application written with Zend Framework and MVC. On my home page, I want to incorporate the functionality to download a dynamically generated pdf file. The way this is done is:
User clicks "download file" link.
On Click, an AJAX call occurs to a PHP controller, which takes the form data, generates the pdf and return...
I have a table that is 640px wide seperated in two [TD]'s. The left one is 150px and the right one 490px.
The question is, using CSS or any other method, how do I stop the content from overflowing the size I have set and making the page look like a mess.
I have have tried the css overflow: scroll method and in some cases this works, bu...
Suppose I have JavaScript code like
myClass = function(){
function doSomething(){
alert(this); // this1
}
}
alert(this); //this2
What those two 'this' objects are refer for??
...
I was wondering how to accomplish an effect I've seen on several websites, where I click a download now link, it takes me to another page, and the download starts automatically. What is the best way to accomplish this?
...
I was wondering if anyone knew a better way to write this block of code.
if($('div.homeBox > div').length > 0){
$('div.homeBox > div').remove();
}
$('div.homeBox').append(data.loadPage);
This works as it is, but I would like to make it pretty if possible. I am replacing a block of code in my page with HTML data returned by an ajax ...