javascript

'Collapse all' problem with jQuery Treeview plugin

And the problem is that after I click on the 'Collapse all' link, 'some' of the pluses and minuses are displayed opposite to what they should be: i.e. an 'expandable' node would be shown with a minus next to it. Apart from that, the tree works correctly. (Well, the 'expand all' functionality is affected, as well but I think this is part ...

How to extract a string using Javascript Regex

Hi all, it might look obvious but I wasted too much time trying to get it to work... I'm trying to extract a substring from a file with Javascript Regex. Here is a slice from the file : DATE:20091201T220000 SUMMARY:Dad's birthday the field I want to extract is Summary, so I'm trying to write a method that returns only the summary t...

javascript, a little coding help, cant figure this out...

Everything below works fine, except that the form doesnt get submitted... it seems the problem lies in the 'x.onchange' event... any tips? var form = document.forms['pic_form']; var x=document.createElement("input"); x.type="file"; x.name="pic_file2"; x.id="pic_file2"; x.size="35"; x.onchange="pic_form_function(form, 1);"; var z...

How to stop sliding if only one <li> using anythingSlider(jQuery plugin)?

I'm currently using the anythingSlider plugin, it works totally fine except when there is only one <li>. The <li>s are generated from the database so sometimes there's only one. However, the anythingSlider plugin still tries to slide through the <li>s, it works by sliding back to the first slide. Although this doesn't look great. Do...

javascript as a virus?.... source Edited

Heres my simple html source <html> <head> <title> Dec2Bin </title> <script type="text/javascript"> function app() { var decimal = prompt("Numero en Decimal"); alert("El numero " + decimal + " en codigo binario es igual a " + dec2bin(decimal)); } function dec2bin(decimal) { var binario=""; while(decimal!=0) { if(decimal % 2==0) { binari...

cut out part of a string

Say, I have a string "hello is it me you're looking for" I want to cut part of this string out and return the new string, something like s = string.cut(0,3); s would now be equal to: "lo is it me you're looking for" EDIT: It may not be from 0 to 3. It could be from 5 to 7. s = string.cut(5,7); would return "hellos it me you'...

Help me take my intermediate Javascript to the next level

Sorry for the semi-rant here. I am hooked on javascript and want some direction on where to explore next! I know the default answer is to just look around at sites and fire up firebug, but that may be inefficient as it's likely many sites have bad design and I won't be able to tell. I could use blogs and sites to follow, like http://aj...

Flash and .Net and Comet

Hi guys, We have a browser based flash(AS2) client application which communicates with .Net based server app. We are using traditional javascript way [ie.ExternalInterface.call] to communicate between server and flash client. We want to remove this dependency on javascript and directly send data to the server from flash. Many times the...

Detect double Ctrl keypress in JS

I have a custom CMS and would like to add a "shortcuts menu" triggered by the pressing of the Ctrl key twice within, say, 300 milliseconds. I use prototype, so my starting point obviously is: Event.observe(document, 'keypress', function(event) { if(event.keyCode == Event.KEY_XYZ) { show_shortcuts}); My approach at the moment would ...

Selenium RC > how to upload file using attachFile()

hello, I am using Selenium RC with Junit framework. I am trying to upload a file using attachFile() method. attachFile: (Information collected from selenium API http://release.seleniumhq.org/selenium-remote-control/1.0-beta-2/doc/java/com/thoughtworks/selenium/Selenium.html#attachFile(java.lang.String,%20java.lang.String)) void attac...

Internet Explorer only part loading JavaScript/CSS

I'm having trouble with my local development environment where IE (6 through to 8) is only part loading JavaScript/CSS files. It throws random errors at random places in jquery.min.js every time I refresh, which suggested to me that it's trying to execute before it's finished loading or the connection was closed before it finished loadin...

Replace the TD tag

I want to replace the <td> tag. My code looks like this: var divele = document.createElement("div"); divele.innerHTML = "<td><p>content</p></td>"; var tdele = document.getElementByd("tdid"); tdele.parentNode.replaceChild(divele.firstChild,tdele); The tdid is replaced with the <p> tag content only not with the <td>. When I assign ...

jQuery serialize function with multple forms

I'm using the jQuery .serialize function and can't get it to serialize the proper form on submit. my js code: function getquerystring(form) { return $("form").serialize(); } my forms: <div class="leave_message_box"> <form name="leave_message_form"> <input type="t...

how to pass embed code in javascript

<a href="" onClick="return select_item(<embed src=\"player.swf\" allowfullscreen=\"true\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" FlashVars=\"id=&flv=1257568908_.flv\" type=\"application/x-shockwave-flash\" width=\"450\" height=\"371\"></embed>')> The above returns an "unterminated string literal" e...

javascript OO question - specify private member function in c# object?

I'm not sure how to achieve the following in javascript, or even if I'm thinking about it correctly. Basically I want to attach a javascript member function to each custom object rendered, so I could have something like this in C#: public class NumericTextBox : TextBox { ... string clientScript = "function isValid() { return isN...

Remove parent element after removing last child element

I have a list of elements on a page, for the sake of discussion we can say I have the following: <div id="group_01"> <div id="entry_1-01">stuff <a href="delete">x</a></div> <div id="entry_1-02">stuff <a href="delete">x</a></div> </div> <div id="group_02"> <div id="entry_2-01">stuff <a href="delete">x</a></div> <div id="entry_2-...

window.print issues with iFrame and IE7

I'm using window.print() from inside an iFrame. This works flawlessly in FF, but not so great in IE7. In IE7, it brings up the Print Dialog, however, the dialog itself is slow, choppy and unstable. I'm having troubles understanding this problem, and any help would be greatly appreciated. ...

sIFR dynamically changing the color of text onhover of parent element

Hi dudes, dudessessess, I'm using sIFR to style headings and want to dynamically change the color of text (within the flash movie) onhover of parent element. How would one do this? Any examples? I have never seen it done. <ul class="tab"> <li id="tab2"> <a href="#two"> <span class="organisation sIFR-replaced" s...

How to disable JQuery keypress event for just one element?

On my site I have registered a keypress event handler for the whole document. $(document).keypress(myhandler); And I handle the 'space' key to scroll a list. Trouble is, there is an <input type='text' /> element, and I don't want 'space' keypress to scroll the list when it is entered in the input. I couldn't find any information in ...

Cycle Pager auto advance with Pause/Play

hi guys i've managed to work out who to make a pager gallery using the cycle plugin WITH auto advance $(function() { $('#s4').before('<div id="nav" class="nav">').cycle({ fx: 'fade', speed: 'slow', timeout: 6000, pager: '#nav', before: function() { if (window.console) console.log(this.src); } }); }); howeve...