javascript

getElementsByTagName() equivalent for textNodes

Is there any way to get the collection of all textNode objects within a document? getElementsByTagName() works great for Elements, but textNodes are not Elements. Update: I realize this can be accomplished by walking the DOM - as many below suggest. I know how to write a DOM-walker function that looks at every node in the document. I ...

Javascript Accessing Multidimensional Array Keys

Hi guys. I have a javascript array that looks like this: '40x27' => array( '1' => 0 '1.5' => 2 '2' = 1 ) '36x24' => array( '1' => 1 '1.5' => 1 '2' = 2 ) etc. I want to print out the values of the inner array like this: i = 0; for (i in outerArray){ var k = 0; for (k in innerArray){ ...

setInterval By the minute On the minute

To the javascript enthusiasts, how would you program a setTimeOut (or setInterval) handle to fire by the minute on the minute. So for example, if it is the 51 second of the current time, then fire it in 9 seconds, if it is the 14th second then fire it in 46 seconds thanks ...

[JavaScript/Google API] Creating custom info windows in Google Maps

Hello, I need to create a custom look for the Google Maps info windows (straight-edge frame and transparency, etc). I understand this is only doable with an external plugin, but I am not sure which one to use. I have tried to use extInfoWindow, but I have had problems with getting it to work properly. I have also looked at PD Marker ...

Using external javascript files in a .js file

Hey, I would like to use an external javascript file in another javascript file. For example, I could store all my global variables in a globals.js file and then call then from the website logic logic.js. Then in the index.html, i would insert the tag. How do I use the globals.js inside the logic.js? ...

Return ActionResult to a Dialog. ASP.NET MVC

Given a method.. public ActionResult Method() { // program logic if(condition) { // external library // external library returns an ActionResult } return View(viewname); } I cannot control the return type or method of the external library. I want to catch its results and handle that in a dialog on the page - but I...

javascript call url from different domain

Hi, I want to post some data via javascript to another domain. Something like: http://www.othersite.com/submitfunnyname?name=blah The other site (othersite.com) has a REST interface that you can call (well actually this is a get example) to submit a funny name to them. Can I do this already with javascript? I'm a little confused on ...

How to pass an anonymous array of strings to a JavaScript function?

I want to pass to an array of controls' IDs to a javascript script function so it will switch control's enable state. For example, in C# it would be like this: func(false, new[] { "Control1", "Control2", "Control3" }); In that function I want to find corresponding controls and disable/enable them. For one control I do this next way: ...

Prototypejs .evalJSON not returning object

I have this JSON (which validates according to JSONLint): [ { "BugCount":"2", "BugTitle":"C:\\INETPUB\\WWWROOT\\CLUBREADY2\\TRAINERS\\../Connections/LTC.asp", "ErrLine":"141", "BugID":"702" }, { "BugCount":"1", "BugTitle":"/admin/ajax_logagreementsig.asp", "ErrLine":"0", "BugID":"1322" }, ] However, whe...

How to replace flash animations like this?

What is the technology used here? (don't worry, its not porn despite the url) http://www.dirtyphonebook.com/dashboard/425-205-1921 It animates a lot like Flash, but when I right click there's no Flash menu. Is it something like canvas or javascript? ...

JQuery class selectors like $(.someClass) are case sensitive?

Given this HTML: <div class="OpenIDSelector">some text</div> Why does this JQuery selector match it on some browsers and some pages, but not on others? $('.OpenIdSelector) NOTE: I ran into this problem and solved it myself, but it was annoying and I didn't find it on StackOverflow already, so I'm posting it as a Q&A pair so someon...

From a Maya scene to a WebGL animation, where to start?

Hi, I've got some time, and I really would like to learn to get my Maya animated scenes into WebGL. I'm not sure where to start really. It would be amazing if I could make a Canvas element and place a Maya scene into it so that it's animating. Does anyone got a tutorial or some hints? PS. Answers about 3ds Max are also welcome! ...

key-words highlight in <textarea> (again)

Wait, I know! I know that this "syntax highlight in textarea"-question was raised like a million times on stackoverflow! But, please, listen. offtopic: I'm not a web-developer, and technically I'm not a programmer at all. I study mechatronics and deal mostly with control-engineering and digital-hardware. And I'm so pissed off that whene...

Jquery: How can I place triggers on images already cached?

Please see: http://flx.me/h/0504/ Source: http://pastebin.com/bDh5k3Qd jquery.preload-min.js: http://jquery.com/plugins/project/Preload jquery.jplayer.min.js: http://www.happyworm.com/jquery/jplayer/0.2.4/developer-guide.htm I'm using jquery.preload-min.js to preload images and to send a play trigger to jquery.jplayer.min.js to start...

How to prevent form submission for a form using onchange to submit the form when certain values are selected

I have a form I have built: <form class="myform" action="cgi.pl"> <select name="export" onchange='this.form.submit()'> <option value="" selected="selected">Choose an export format</option> <option value="html">HTML</option> <option value="csv">CSV</option> </select> </form> Now, this form works fine if I pull down ...

Javascript + Pretty Print JSON

I'm looking for a jQuery plugin or a standalone script that will take a javascript object and create a navigatable tree like the FireBug plug in does. Does this exist, or will I need to write one? Googling hasn't found much yet. ...

javascript: problem with function

hi I have this simple function: <script type="text/javascript"> //<![CDATA[ jQuery(function($){ function here(b){alert(b);} ; here(6); }); //]]> </script> and i have this button on page: <button onclick="here(7);">TEST</button> The alert fires on page load, but not on button click. If i replace the here(7) ...

Add Hover display for table cell

I have a table, but it is not in a list format, meaning not a column/row format. I look for specific cells to add a hover event that displays a description of the cell. $("#TableID td").hover(function(){ //ifCellThatIWant $(this).append("<span>Message that was brought in</span>"); }, function(){ $(this).children().remove();...

Ajax post request, an object that includes an array and other objects, can't be parsed correctly into rails, if i do it with jQuery it works but i dont want jquery im doing it in native javascript.

what i want is to get a proper parameter, if you see the parameter been logged you would tell there is something wrong my javasript: first run the runMe function Ajax: function() { var xmlhttp, bComplete = false; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHT...

OnResize Event for all browsers?

Hello all, I was wondering if there was to fire an event upon the resizing of the window that would work for all browsers. Any help would be appreciated. Thanks in advance. ...