Using the Firebug console is there a way to log the content of the global namespace? I particularly want to recognise when something is added to it by my code. I could step through my whole code :( but I'm hoping there is an easier way.
I know function name can be invoke by string using the following: window[functionName] But how do I use this for namespace function i.e. myname.function ?
I am having an issue with adding namespaces to my JavaScript. When I run this code in FireFox everything works fine. When I run this code in IE7, I get and error saying “Not Implemented�. It is pointing to the line of code where I Instaniate the object (testNameSpace.menu = new js.JavaScriptCodeIsHere(); ). Does anyone know why this works in FireFox but IE7 tells me I have not implemented something? Code:
I'm working on an app, which createsvisualizations based on SVG. I was using jQuery SVG by Keith Wood at first [URL], but at some point I've noticed that it's very inconvenient for some stuff and wrote my own functions to handle everything. One of the quirks when creating svg trees dynamically is that you have to create all elements and set attributes using the SVG namespace ("[URL]"), otherwise they aren't rendered correctly by browsers.
Here's an example of how you create a text element... var svgns = "[URL]"; var newText = document.createElementNS(svgns,'text'); newText.setAttributeNS(null,"x","0"); newText.setAttributeNS(null,"y","0"); $(newText).text("some text"); $(svgGroup).append(newText);
There doesn't seem to be a way to do that more effectively using jQuery. For instance, you can't use attr to set multiple attributes, since it won't use setAttributeNS.
but not in this form: $(element).children("dl\:object").I don't care that it doesn't work in the second, because I only need one time access, since I replace these custom elements with valid html using javascript, as soon as the page loads (sort of like xfbml I guess).My concern is that it DOES work even in IE, which only returns a tagName of "object" from <dl:object>. (given the following html attribute: <html xmlns:dl>). So I'm suspicious. I've tried following the code that matches the selector, but I can't do it, it's too complex for me to follow in a reasonable time.
i'm a newbie on jquery i'm studying it with the latest version, and following a book called "Learning Jquery" but iencountered a error, and i don't know what the problem is:
i copied the code from the book like this:$('a[@href^="mailto:"]').addClass('mailto'); to try to change the links which start with "mailto" to the new class "mailto" but there's a error reported: uncaught exception: Syntax error, unrecognized expression: [@href^="mailto:"]
The DOM Level 3 specification has a section (1.2.2.2) that talks briefly about "groups" of event listeners. What does this mean? Is this similar to attaching event listeners with a namespace, as in jQuery: "event.my_namespace"?
I have some JavaScript which is splitting out the different variable elements from the URL.Now, how do I set the internal variables?Then I want to set the variable ScriptHeading to be Change and the variable ScriptType to be NewThread.I keep finding all sorts of lovely code showing how to split out the various sections in many different ways, but I can't find anything on how to actually set these variables.
I am trying to order a laptop from the Dell online shop but everytime I try to press 'continue' after picking the options, I get an error message in the lower left hand corner of the browser. I'm using WIN 98SE with java enabled on my laptop.
I would assume there's a bug in that line. Although there's little I can do about it other than forward it to the Dell folks - my pgming background has me curious as to what's causing this!
I have this JavaScript that is supposed to show random products from my database, and show something different every time you refresh or revisit. But I keep getting an error - on my computer - that says Syntax Error in Line 2.
There is no error on most other computers, and the products show, but another script on the page, an article title scroller, stops - on most computers, but not all. It says "no articles available".
I've tried the script on an asp page and a htm page, all by itself, but it still doesn't work. I tried changing all kinds of settings in my browsers, but nothing helps. I'm on XP, SP2, which I've heard has some problems handling javascripts. I don't know if that's true, but if it is, I know that lots of other people will have the same problem as me when they view the page. Actually, I think it is a good thing, that my computer is pointing out this error. I get the error message in IE6, but in NS8 and FF, I just don't see the products. No error message.
Anyway, here are the first three lines of the script:
<% if TRIM(request.servervariables("http_referer")) = "" then %>
Using spellcheck, I found that referer is spelled wrong, it should be referrer. I don't know if that is right for javascript (or asp?), but correcting it didn't make a difference.
The script is JavaScript on an asp page, and it is called in an htm page.
How does one center text in an alert box? and how do you make the alert box appear in the middle of the screen? I've seen it done, but my alerts have text left justified, and the box is longer than i need.
I found this in one of my old scripts but I can't remember what the -0 was used for. I remember it was a shortcut method but I can't remember for what. Does this ring a bell with anyone?
var Pattern = /px/; var T = paddingArry[0].replace(Pattern, "")-0;
Does the "semicolon insertion" really affect you if you format code as
function x (y) { // ... }
instead of:
function x (y) { // ... }
The jslint page complains about lines ending in ) due to the nebulous idea of "semicolon insertion". I have not reviewed the ECMAScript pdf in great detail to try to pin this pretty-printing issue down. In general, I find that code formatted in the "K&R" style (opening brace on same line as if, while, function) confusing and difficult to read compared with placing curly braces on separate lines.
On another subject, the difference between inner functions defined explicitly versus defined using function expressions seems like a good one for a FAQ. Under what circumstances does it make a real difference whether you use function expression versus function statement versus Function object?
What is the syntax for hiding div tag for safari, firefox, chrome.In my webpage i've 2 div tag, based on the condition i'll show any one at a time.Can any one give a syntax to hide div in all kind of browser.
I have a program written in Javascript and fully functioning which takes a user-selected directory name and then displays all the photos in that directory in a certain format.
I am now wanting to expand the program to allow users to optionally enter their own strings and the program will use all the photos from www.flickr.com which use that string as a tag.
I have a PHP interface to flickr (called PHPflickr) which collects all the relevant photo urls. I now need to get these images back into my Javascript so I can process them using the existing functions (rather than rewrite all my functions in PHP code and have two sets of functions in the program). I found on another thread a means to do this for a date variable:
but being completely new to PHP I'm not sure what "addslashes" might be or what formatting will be necessary if I am starting with an array of urls. Code: