NameSpaces - Getting FunctionB To Use A Var From FunctionA
Mar 25, 2007
I am trying to devise a scheme where if a user clicks divA and then clicks divB, divB will be able to use a var that was defined in the divA clicked function.
<div id="divA" onClick="selectAttacker()">your unit</div>
<div id="divB" onClick="doCombat()">enemy unit</div>
the user first selects an attacker and then does selects the enemy for the attacker to fire on...
how do I make it so that in the doCombat() function I am able to reference that divA was the unit responsible for causing damage to divB???
View 2 Replies
Mar 9, 2011
Using jquery 1.5 and part of my XML is this
<gd:when endTime='2011-03-03T16:00:00.000-06:00' startTime='2011-03-03T11:00:00.000-06:00'/>
If I use:
$(xml).find('gd\:when').each(function(){
alert($(this).attr('startTime'));
});
[Code]....
It works in Safari but in Firefox I get the error:
uncaught exception: Syntax error, unrecognized expression: [nodeName=gd:when]
View 3 Replies
View Related
Mar 30, 2010
I'm using jQuery 1.4.2 and attempting to parse an RSS XML file via AJAX. In Firefox, using "media\:thumbnail" works fine to get an element with a namespace. This fails in IE 8, Safari for Windows and Safari for Mac and iPhone. Getting other elements without a namespace works fine in all browsers. Here is a code snippet:
// Define the RSS feeds to load for thumbnail images
var rssFeeds = new Array("photo/Favorites_2008/photos.rss",
"photo/Favorites_2009/photos.rss");
// Load images from MRSS feeds
function loadImages() {
// Loop through all RSS feed URLs
$.each(rssFeeds, function(key, value) {
// Make an AJAX call to get the RSS feed
$.ajax({url: value,
dataType: "xml",
async: false,
error: function(reqObject, textStatus, errorThrown) {
console.log("AJAX Error: " + textStatus + " - " + errorThrown);
}, success: function(xml, textStatus) {
// The RSS is Yahoo MRSS - get the thumbnails
// xmlns:media="[URL]"
console.log("AJAX Request Success");
// This find expression works in Firefox, but not IE or Safari
$(xml).find('media\:thumbnail').each(function () {
// $(xml).find("title").each(function () {
// Add the thumbnail URL to the image array
favImages.push($(this).attr("url"));
// console.log("Added Image: " + $(this).attr("url"));
});}});});
The RSS feed is here: [URL]
The tag in question:
<media:thumbnail url="[URL]" />
The docs say to use a double backslash, but it doesn't work in all browsers.
View 1 Replies
View Related