javascript

asynchronous .js file loading syntax

Hi, I noticed that there seems to be a couple of slightly different syntaxes for loading js files asynchronously, and I was wondering if there's any difference between the two, or if they both pretty much function the same. I'm guessing they work the same, but just wanted to make sure one method isn't better than the other for some reaso...

jQuery scroll fails for iframe (firefox)

I cannot get scroll to work, here is the complete stuff: http://zed.mit.edu/scroll2/buc.php I'm trying to refresh the page while maintaining the scroll position of the iframe inside. I'd like to have an alert when I actively scroll the iframe, these two both fail: $(top).frames['#iframe_bucinid'].scroll(function() .... $('#iframe_bu...

javascript regex question ?

I have following div: <div id = "zone-2fPromotion-2f" class = "promotion"> How can I get value 2f present in the end, actually it is the value of Promotion and how can I retrieve it ? I was using this.match = this.id.match(/(Promotion)-([0-9a-f]{2})/); but it is not giving me exact result but it gives me array of (Promotion-2f, ...

Object window left over in a javascript bookmark

Currently I'm using the following as a bookmark in Firefox 3.6.3. It redirects me to the RFC just fine, but the active tab says [object Window]. What do I need to do to get rid of that artifact? javascript:var rfc=prompt("RFC Number");window.open("http://ietf.org/rfc/rfc" + rfc + ".txt") ...

Why can't I use relative URLs with IE7?

Hello everyone. I've been Googling for a while and can't seem to find an answer to this question. My problem is as follows: For my jquery, I need my links to be relative rather than absolute. My PHP is set to return relative urls and everything is working fine, until I test it in IE7. For some reason, IE7 keeps changing my relative urls...

dynamic tag count on keyup

Hi All, I have a div that contains many spans and each of those spans contains a single href. Basically it's a tag cloud. I have a textbox with a keyup event that filters the tag cloud div (It actually just hides the tags if not in filter condition). Is there a way to get a count of the tags shown as the keyup event occurs? Thanks, r...

When someone clicks "back", how do I get the user to the same position? (PHP)

When someone clicks on a link, it sends them to it. But when a user clicks back, i want it to be at the position where they were before. What is the name for this and how do I go about doing this? Like on SO, when I click "back", the scroll bar isn't at the top but rather at the position where I was last. ...

How to pass parameters in when call code-behind function in javascript?

Suppose I have a function in code behind like: Public Function Calc(ByVal ID As Integer) As Boolean '...... End Function I can call this function in javascript like var isSuccess ='<%=Calc()%>'; but how to pass the parameter in for this case? Following code not working: var ID = 1; var isSuccess ='<%=Calc(ID)%>'; Here ID sho...

Changing the Android Webview hash without reloading page

Hey, I'm got a custom webview setup which is working pretty well, but I'd like to be able to either: 1, change the url hash without the webview reloading the page (it would lose the state of my js app) 2, call some js that sits within my web page from within android. I can't change any JS within the site, unfortunately, so can't cust...

Elements added with appendTo() not immediately available

I'm having a problem with elements added with appendTo() not being immediately available in the DOM. First, I'm reading some data from a JSON file and then appending some html to a div. Then I'm calling a random shuffler plugin to show one of the added divs at a time. jsonUrl = "js/performers.json"; $.getJSON(jsonUrl, functio...

Javascript array of hrefs

Hi, I am trying to create an array with different hrefs to then attach to 5 separate elements. This is my code: var link = new Array('link1', 'link2', 'link3', 'link4', 'link5'); $(document.createElement("li")) .attr('class',options.numericId + (i+1)) .html('<a rel='+ i +' h...

Use jQuery Fancybox(lightbox type dialog) with dynamically loaded links

I'm trying to bind Fancy box links so that when the new links are created it will still work. I've seen a few other question on here but not really answered. This is what I'm trying to do. jQuery("a#[id^='domore_']").fancybox({ 'autoDimensions' : false, 'width' : 'auto', 'height' : 'auto' }); This works fine but whe...

Defining action on window load

I am trying to get a page to display specific properties depending on whether or not a specific cookie is set... I am trying this var x = readCookie('age'); window.onload=function(){ if (x='null') { document.getElementById('wtf').innerHTML = ""; }; if (x='over13') { document.getElementById('wtf').innerHTML = "...

JavaScript Object literal notation confusion

In Firefox console, this code will generate error: {"d" : ["bankaccountnumber", "$1234.56"] } > SyntaxError: invalid label { > message="invalid label", more...} this code works just fine {d : ["bankaccountnumber", "$1234.56"] } > ["bankaccountnumber", "$1234.56"] this code works fine as well var a = {'d' : ["bankaccountnumber...

Ensuring load code fires in jQuery event if attaching event after load occurs

I'm trying to figure out how I can best attach a load event to an element, but be sure that it gets run. The issue comes when I bind to the load event of an img, but that binding happens too late and the image has already loaded. Is there some way in jQuery to check if the image is already loaded? Its obviously an intermittent issue, ...

Alt attribute encoding with JavaScript

Hi, Html entities must be encoded in alt attribute of an image in HTML page. So <img id="formula" alt="A &rarr; B" src="formula.png" /> will work well. On the other hand, the same JavaScript code will not work document.getElementById('formula').alt = 'A &rarr; B'; and will produce A &rarr; B instead of A B. How to do it through...

Converting an int64 value to a Number object in JavaScript

I have a COM object which has a method that returns an unsigned int64 (VT_UI8) value. We have an HTML page which contains some JavaScript which can load the COM object and make the call to that method, to retrieve the value as such: var foo = MyCOMObject.GetInt64Value(); This value can easily be displayed to the user in a message dia...

How to execute an exe using Javascript?

I need to open an EXE from a folder, when the folder is present, using javascript. I have added the code, but am not able to open the EXE after checking the folder, please share your thoughts. <html> <body> <script language="JScript"> <!-- function checkfolder() { var myObject; myObject = new Active...

Detect when a new property is added to a Javascript object?

A simple example using a built-in javascript object: navigator.my_new_property = "some value"; //can we detect that this new property was added? I don't want to constantly poll the object to check for new properties. Is there some type of higher level setter for objects instead of explicitly stating the property to monitor? Again, I d...

MooTools Classes and JsDoc

I have the following Moo class: Nem.Ui.Window = new Class({ Implements: [Options, Events], options: { caption: "Ventana", icon: $empty, centered: true, id: $empty, width: $empty, height: $empty, modal: false, desktop: $empty, ...