javascript

Adding an Option to a Select Element with javascript using the Prototype library

Hey Guys n Gals! Want a to add an option dynamically to an Select element using prototype. There seems to be a lot of different ways to do it out there, all to do with options.add etc... Not seen much in the way of cross-browser ways. Want it to be as light-weight as possible. This is what I have got so far. It's just the appending ...

How to access PHP methods inside a Javascript?

I have made a method which will delete a file. first i echo the url to this file. like this echo "<a href='$fulr'>$filename</a>"; now basicaly i want to call the function deletefile($file); how can i do it like this echo "<a onclick='$this->deletefile($filename)' href='$fulr'>$filename</a>"; is that even posible? Or how can i i...

Scripting.Filesystemobject filemove, writefile not working from javascript in IE browser (workarounds, doc?)

I know it's a huge security hole to use Scripting.Filesystemobject from javascript in the browser. I heard a rumor that MS is locking down this hole in the latest version of Office. This would be bad news for the enterprise web app I am working on, which has a few critical functions which depend on access to Scripting.Filesystem object...

JQuery Validate Plugin: make input required depending on radio button value

Hi all, I'm having a real headache trying to get the jQuery Validate plugin to work. I have a form, the first question asking the user to select an option from a radio group. This shows further questions below, depending on their selection. What I'm trying to achieve is making the visible questions required, but obviously depending o...

JQuery Dialog Div Height

I am trying to get the height of a JQuery UI's dialog's div once opened, so that I can set the parent's iframe height dynamically. However it seems to be returning me the height of the div before the footer button panel and title panel are added. The height for the dialog is set to "auto"; $(this).height($('#dialogdiv').height()); I...

Converting a string of JS Array to PHP array

I have a string (in PHP) representing a JS array, and for testing purpose would like to convert it to a PHP array to feed them into a unit test. Here's an example string { name: 'unique_name',fof: -1,range: '1',aoe: ',0,0,fp: '99,desc: 'testing ability,image: 'dummy.jpg'} I could use a explode on the "," then on the colon, but that is...

Character encoding changes after window.open()

The site from where I'm calling the window.open() function is in UTF-8, using the <meta> tag, everything works well, but once I call the function and open another window with the same tag, the new window shows weird characters even thought in page info it shows that the encoding stays the same (UTF-8). This is the same problem as mine: ...

Set desktop background image with JavaScript

Is it possible to set the desktop background image using JavaScript? I'm pretty sure it's not possible but I thought I would check. If it isn't possible, is there any way for it to be done from the page? ...

Hiding Groupings Only Containing 1 Element (in Sharepoint)

I have a list in Sharepoint that contains a few hundred groupings. Some groupings only contain 1 row, and in those cases, I want to removing the grouping header above. To do that, I think I need to hide all of the code (below) using jQuery. I want to make the logic so that it looks for the portion ">‎(1)", and if it finds that, it hid...

Script# preprocessor directives?

Hi, does anyone know the preprocessor directives that are available for use in the script.jst file. I am trying to write the filename of the generated js file to the generated .js file. ie. script.js or script.debug.js Thanks Donal ...

Page Preview with JavaScript?

So I'm using the Ajax Control Toolkit and it's HTML Editor. I'm wondering what is the best approach to create a complete page preview? I have multiple HTML Editor's on the page so I need to get the content of each HTML Editor and save it to a cookie or something, then have a popup with the preview page, which loads the info from the co...

HTML textarea: use JavaScript to get wrapped text?

If I've got a textarea like this: <textarea id="foo" cols=80 wrap="hard"></textarea> Is there any way, using JavaScript, to grab the hard-wrapped text? I've tried the obvious $("#foo").val(), but that returns the unwrapped text. For example, if the textarea is: <textarea id="bar" cols=5 wrap="hard">a b c d e f</textarea> The brow...

Javascript equalsIgnoreCase: case insensitive string comparation

How do I perform case insensitive string comparison in Javascript. ...

Javascript collapsable menu not visible when appears over Silverlight

Hi all. I'm doing a Javascript menu with collapsable items, but for some days I've unable to make this appear when appear "over" a Silverlight control. Javascript menu uses DIVs to make this collapsable menu but it does't appear meanwhile a Silverlight control is there. Thanks in advance for any suggestion ...

How to profile and and get Javascript performance

I have a few scripts that use jQuery, and I think I have a memory leak in one of them. How one could profile and find what parts of the scripts that I have are using the most memory/CPU? Thanks ...

What do you do if your site visitors have JavaScript disabled?

What would you do if your site visitors disabled JavaScript? Do you block them? ...

javascript ampersand (&) in return data will not show as value

Hi! I have this bit of code: ... var aData = request.responseXML.getElementsByTagName('data')[0]; var sDescription = aData.getElementsByTagName('description')[0].firstChild.data; alert(escape(sDescription)); document.getElementById('tempLabourLineDescription').value = sDescription; ... sDescription is outputting: SUPPORT ASSY-FUEL ...

How to prevent JavaScript HTML blocking

How do I prevent JavaScript from blocking other JavaScript's from starting to download? I have the following on my web site: <html> <body> .... <script type="text/javascript" src="http://example.com/ex.js"&gt;&lt;/script&gt; <script type="text/javascript" src="http://google.com/google-maps.js"&gt;&lt;/script&gt; </body> </html> When ...

Create Firefox Addon to Watch and modify XHR requests & reponses

Update: I guess the subject gave a wrong notion that I'm looking for an existing addon. This is a custom problem and I do NOT want an existing solution. I wish to WRITE (or more appropriately, modify and existing) Addon. Here's my requirement: -> I want my addon to work for a particular site only -> The data on the pages are encoded us...

JS variable number of arguments to function

Is there a way to allow "unlimited" vars for a function in javascript? Example: load(var1, var2, var3, var4, var5 etc) and load(var1) Tom ...