javascript

What is the difference between javascript and DOM?

What is the difference between JavaScript and DOM? id DOM related to firefox? is DOM just a source order of HTML elements? ...

Call methods on native Javascript types without wrapping with ()

In Javascript, we can call methods on string literals directly without enclosing it within round brackets. But not for other types such as numbers, or functions. It is a syntax error, but is there a reason as to why the Javascript lexer needs these other types to be enclosed in round brackets? For example, if we extend Number, String, a...

Qt 4.6 Adding objects and sub-objects to QWebView window object (C++ & Javascript)

I am working with Qt's QWebView, and have been finding lots of great uses for adding to the webkit window object. One thing I would like to do is nested objects... for instance: in Javascript I can... var api = new Object; api.os = new Object; api.os.foo = function(){} api.window = new Object(); api.window.bar = function(){} obvious...

JQuery: How does Gowalla perform it's "slide" effect?

How does Gowalla.com perform it's slide effect on the frontpage? What JQuery effect can mimic that functionality of the sliding down effect? ...

how to get jquery.couch.app.js to work with IE8

I have tested this on Windows XP SP3 in IE7 and IE8 ( in all compatibility modes ) and Windows 7 Ultimate in IE8 (in all compatiblity modes) and it fails the same way on both. I am running the latest HEAD from the the couchapp repository. This works fine on my OSX 10.6.3 development machine. I have tested with Chrome 4.1.249.1064 (45376)...

How can I import a text file into javascript from an external website using jquery $get()?

When the button in the following script gets clicked, it should load in the contents of the file "http://tanguay.info/knowsite/data.txt" and display it on the screen. What is the correct syntaxt so that the .get() function retrieves the data from the external website and puts it in #content? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...

How to combine has() and gt()

With jQuery 1.4.2, I can't figure out how to combine has() with :gt. I'd like to select any <ul> which contains more than 3 <li>s, so here's what I've tried: $(document).ready(function(){ $("ul.collapse:has(li:gt(2))") .each( function() { $(this).css("border", "solid red 1px"); }); }); This does work with t...

Venkman's javascript debugger

I'm trying to understand if I can debug a stand alone .js file which doesn't interact with browser. Is there any way to just load it and debug or I will be forced to encapsulate it into html file? Environment is Windows, no browser objects are required. ...

JQuery: How to text insert HTML ascii character?

I have the following JQuery code: $(this).text('Options &#x25B4;'); However, the ascii code isn't showing up on my web page. All that shows up is on the webpage is Options &#x25B4;. What am I doing wrong? ...

Help me diagnose this jQuery loop / Bookmark Hash problem ?

I'm having some trouble getting my jquery to render correctly 100% of the time - the code I am using is located below. Its purpose is to "simulate" the feel of a threaded forum by hiding everything but the subject of replies - when a subject is clicked, the 1st post is then replaced with the reply. You can see an example of it in actio...

How to load file into javascript

I have an HTML table that should be updated according the file that user uploads. In other words, I would like user to be able to upload a file, and change the contents of the table according to file content. The file size can be several MB. What are my options ? Do I must to upload the file to a server, or it can be done in client side ...

JQuery: Push Effect?

I'm currently using the JQuery slideDown/slideUp effect and am not accomplishing what I want. Essentially, I want to create an action where I "push" a div off the top of the browser window. Something similar to the following push effect example. How can I do this with JQuery? The problem with just using slideDown/slideUp is that the ...

getting all filenames in a directory with node.js

I can't find where in the documentation I can get all filenames in a directory Thanks for any help! ...

How to let a user input html into a textarea? I have problems if they try to include <textarea> inside a text area

So i have a space where users can input text/html, and it will show up on another page. Sounds pretty simple right. Well this space is a text area - again exactly what you would expect. But if the user tries to enter in a tag and the tag, then the will close the textbox the next time they load the page (with the previous text inserte...

Jquery counting elements by class what is the best way to implement this?

Ok what i'm trying to do is to count all of the elements in the current page with the same class and then i'm going to use it to be added onto a name for a input form. Basically i'm allowing users to click on an and then by doing so add another one for more of the same type of items. But i can't think of a way to count all of these simp...

Event handler triggered twice instead of once

Hi all, I am sorry that I have asked two questions in a few minutes. In a html file, I got three child DIV tags in a parent DIV tag: <div id="container"> <div id="frag-123">123</div> <div id="frag-124">124</div> <div id="frag-125">125</div> </div> Now when I click either the three child DIV tags, I will see two alert boxes ...

Dynamic generated file upload control<using javascript> doesn't post?

Hai I am having a form which contains a filetype like this <tr><td> <input name="ufile[]" type="file" id="ufile[]" size="50" /></td></tr> on submit i am calling a script function addRowToTable() { var tbl = document.getElementById('uploadTab'); var lastrow = tbl.rows.length; var iteration = lastro...

asp.net mvc encode on form post

Hello, I'm using a rich text editor in my asp.net mvc form (nicedit with a textarea) and when I submit the form on post, because it is not html encoded I get the following message: "A potentially dangerous Request.Form value was detected from the client" . How can I html encode the textarea on post ? I don't want to cancel the validation...

How to not use JavaScript with in the elements events attributes but still load via AJAX

I am currently loading HTMl content via AJAX. I have code for things on different elements onclick attributes (and other event attributes). It does work, but I am starting to find that the code is getting rather large, and hard to read. I have also read that it is considered bad practice to have the event code 'inline' like this and th...

How to remove the parent element using plain javascript..!!

How to remove parent element and all the respective nodes using plain javascript. I m not using any Jquery or other library. Its like u are havin an element and when user click on that u want to remove the parent to parent element.(also the respective chlds nodes of that) EDIT <table id='table'> <tr id='id'> <td> ...