I have a label that is sometimes empty. How do I set up a conditional statement on the client side to test this?
i have
var label = document.getElementByID("<%=label1.ClientID %>").innerHTMl;
to get the text, but i can't seem to figure out an if..else statment if it is empty or not. label.length == 0; label == null, etc don't seem...
I am trying to change the url of a currently open tab in javascript firefox extension
Any pointers please?
...
Hi,
I need to check in some fast way if there is any text nodes on page, excluding white space.
Preferably, I'd like to see if there is a way to do this with jQuery, and to be cross-browser.
Thanks
...
I have a C++ desktop application (written in wxWidgets) and I want to add support for some scripting language.
Scripting would mostly be used for run-time conversions of strings, numbers and dates by user supplied JavaScript code.
I'd like to use JavaScript because it is widely used and everyone is familiar with the syntax.
Googling ...
Hello guys,
Below I present you some code which has completely been butchered by me.
$(".gig").hover(function() {
var id = $(this).attr("id");
var time = $(this).attr("title");
function () {
if (time > 0)
{
var answer = $('<div class="roll">Are you attending? <a href="' + id + '">Yes</a></div>').hide();
}
else
{
va...
There is a good generalized method for defining private and protected properties and methods in Javascript, here on the site. However, the current version of Prototype (1.6.0) doesn't have a built-in way to define them through its Class.create() syntax.
I'm curious what the best practices are when developers want to define private and p...
This question has been asked similarly before (http://stackoverflow.com/questions/66420/how-do-you-launch-the-javascript-debugger-in-google-chrome), but I can't seem to debug Javascript in Google Chrome.
If I go to Page > Developer the "Debug Javascript" (Ctrl+Shift+L) is disabled. Alt + ` doesn't work.
I'm developing a 'content scrip...
I'd be interested to hear how people handle conditional markup, specifically in their masterpages between release and debug builds.
The particular scenario this is applicable to is handling concatenated js and css files. I'm currently using the .Net port of YUI compress to produce a single site.css and site.js from a large collection of...
I'm working on a help system in HTML, and I'd like to have links that the user can click to execute commands inside an application written in .NET (eg, to complete steps in a tutorial or workflow). I've looked at the TCard() method for HTML help, but it only works in compiled help (.chm), and I'd like to do this in plain html that can b...
I'm trying to use jquery to write a fast function that calculates the pixel width of a string on a html page, then truncates the string until it reaches an ideal pixel width...
However it's not working (the text doesn't truncate)...
Here is the code I have:
function constrain(text, original, ideal_width){
var temp_item = ('<span...
I am looking for a javascript on the fly "Table Of Contents" generation from HTML (with anchors).
Example:
<h1>First level1 heading</h1>
lorem ipsum
<h2>1a heading</h2>
lorem ipsum
<h2>1b heading</h2>
lorem ipsum
<h1>Second level1 heading</h1>
lorem ipsum
Should return something like
First level1 heading
1a heading
1b h...
async="async" attribute of a tag in html, What does it mean?
Can be see used here for example
...
The while statement in this function runs too slow (prevents page load for 4-5 seconds) in IE/firefox, but fast in safari...
It's measuring pixel width of text on a page and truncating until text reaches ideal width:
function constrain(text, ideal_width){
$('.temp_item').html(text);
var item_width = $('span.temp_item').width();
var...
If I have a javascript object/assoc. array defined like this:
function somefunction(options) {
var defaults = {
prop1: 'foo',
prop2: 'bar'
};
//Do stuff here
}
and I want to use this as the default values for the function. So when the function gets called I want to populate the options variable with the...
I have a script that is being inserted dynamically via another script. The code in that script is wrapped inside the $(window).load() event because it requires the images on the page to have all loaded. In some browsers it works fine, but in others it seems not to fire because the page has already finished loading by the time the code ...
Hey all. I was fortunate enough to have Paolo help me with a piece of jquery code that would show the end user an error message if data was saved or not saved to a database. I am looking at the code and my imagination is running wild because I am wondering if I could use just that one piece of code and import the selector type into it an...
I'd like to access some Google API's from within an iPhone native app. I'm not a web programmer and have never used AJAX, but I'm guessing I need some kind of bridge between Objective-C and Javascript. Ideally I'd just fire XML at Google and process the result.
I really have no idea were to start.
Has anyone successfully done this, or...
I have a custom Javascript object that I create with new, and assign attributes to based on creation arguments:
function MyObject(argument) {
if (argument) {
this.prop = "foo";
}
}
var objWithProp = new MyObject(true); // objWithProp.prop exists
var objWithoutProp = new MyObject(false); // objWithoutProp.prop does not ex...
Possible Duplicate:
Multiline strings in Javascript
In Ruby you can do something like this
temp = <<-SQLCODE
select * from users
SQLCODE
This way you have very long string literals in your code without have to escape lots of characters. Is there something similar in JavaScript?
Currently I have javascript code like this, an...
Note: A possible solution needs only work in Firefox 3.0, my app doesn't allow access from IE! =)
I have a link that, when clicked, will display a lightbox to the user:
<a href="#" onclick="show_lightbox();return false;">show lightbox</a>
My problem is that when the lightbox is displayed, the focus remains on the link. So if the user...