javascript

Firefox addon, accessing selection object via javascript

the javascript file contains this code: function getSelected(win) { sel = win.getSelection(); alert(sel); } The browser.xul file contains this: <popup id="contentAreaContextMenu"> <menuitem id="selection" label="Select text" accesskey="S" oncommand="getSelected(window);"/> </popup> The alert is blank, why? ...

Javascript scroll

How to scroll to top of the page in php with javascript scroll(0,0); -> this is not working? On click of submit, i call a function to validate the form and incase of error i will be setting the errormessage thru innerhtml and need to scroll to top of the page without submitting. Everything works...but its not scrolling to top of the p...

How Can I minimize the HTML code by making it one line of code?

So I have made a web page of HTML, Inline CSS and JS. Since this page will be produced through JS function opened.document.write(); I would like to put all the web page code into one line that can be taken in one of the previously mention function instead of repeating the same function for every new line. I can't affors doing this man...

Is there any client side validation library that is using tooltips to display validation messages?

I need to include client side validation on one of my forms, and the webdesign did not take into account any space for validation messages. I think using validation tooltips together with some borders around non-valid input controls would do the job, but I am having problem finding any javascript validation that is using tooltips. Can ...

ExtJs: Tree: how to scroll directly to a specific element ?

Hi, I'm looking for a way to scroll to a specific element in a Tree. Any idea how to do this ? ...

ExtJs: Tree: how download then select using AJAX calls ?

Hi, Here's my goal : - open a tree - download the root nodes - expand automatically one specific node using AJAX (and loop n times here) until i find a leaf then select the leaf Here's the function that works when I declare the Tree : listeners: { load: function(n) { console.log('load(n)'); ...

working with none english text in firefox extension (addon)

This is the code that I have in javascript file inside my addon: function ShotText() { var inputString = "שלום"; //Hebrew letters alert(inputString); } When I run this function using addon I get this: But if I run the same code without addon (regular javascript function), I get this: Where is the problem?...

browscap ini directive not set

I'm using the get_browser() function in an attempt to warn people that their browser doesn't support Javascript. Actually I'm using it to tell them they can use certain parts of a web application I'm building. I've decided to properly use Javascript because I'm tired of listening to developers that are scared of using it and I've seen so...

jquery gallery fade in/out

Hi There, I am building a simple image gallery based on the following markup: <div id="image-list"> <ul> <li id="image-1"> <img src="myimage1.jpg" width="500" height="500" alt="My Image" /> </li> <li id="image-2"> <img src="myimage2.jpg" width="500" height="500" alt="My Image" /> </li> <li id="image-3"> <img src="myimage3.jpg" width="5...

ExtJs: TreeLoader: it doesn't work but why?

If I do this : it works : var myTreeLoader = new Ext.tree.TreeLoader({ dataUrl: 'json/test.php', }); If I add this code it doesn't work : var myTreeLoader = new Ext.tree.TreeLoader({ dataUrl: 'json/test.php', load : function(loader,node,response) { } }); My question is : why ? Edit/Delete Message ...

Javascript: Using setTimeout in For...In Loop

Here's my issue. I have this function to test proxy servers. function crawl() { var oldstatus = document.getElementById('status').innerHTML; document.getElementById('status').innerHTML = oldstatus + "Crawler Started...<br />"; var url = document.getElementById('url').value; var proxys = document.getElementById('proxys')....

What is this obscure error in Google Analytics tracking code on a _trackEvent() call?

I am calling the Google Analytics _trackEvent() function on a web page, and get back an error from the obfuscated Google code. In Firebug, it comes back "q is undefined". In Safari developer console: "TypeError: Result of expression 'q' [undefined] is not an object." As a test, I have reduced the page to only this call, and still ge...

Why wont this class be applied to the image?

I have some js code which generates an image-tag like this: main_pic_div.innerHTML ="<img src='"+path_big_image+"?"+Math.random();"' class='shadow'>"; But the class wont be applied to it... Here is what you get when you 'view source' in firefox: <img src="ad_images/Bilar/441372870_1.jpg?0.6932381395385144"/> The class isn't ev...

$.getJSON back button showing jason return data not the page

Hi there, I have a little issue with my site. I have a page that hosts a google map. However the map does not get shown until the user clicks a button. It then call $.getJSON to get the addresses that i need to show on the map... $.getJSON(theurl, function(json) { ... } It all works fine. However if the user then moves to a di...

How to compress JSON with PHP?

I'm writing a little analysis page which will help me hunt down bugs in an application. In essence it allows to visually compare actual data and log entries, plus perform a bit of analysis on the data. Since this is for debugging only and since I will be deploying this on the live site I want it to have as little server load as possible...

Output RSS feed as html?

Are there any free php/javascript libraries out there which would help in displaying an RSS feed as html? ...

replacing linebreaks in javascript doesn't work :(

Hey there, I'm trying to replace a <blockquote>...</blockquote> with >> ... This is my Code: var testhtml = 'sdkjhfbs <blockquote>skldfjsfkjghbs\n sdjkfhb ksdbhv isl\n kdjbhdfgkj bs</blockquote>kdjfgnkdfj'; alert(blockquoteConvert(testhtml)); function blockquoteConvert(html) { return '>>' + html. replace(/<blockquot...

Content do not appear in iframe until i use the edit button in firebug

Its getting me crazy in FF. I tried the same page in Chrome and content appears instantly. I have an iframe that is loading a chart from another page. The problem is that the chart do not appears until I inspect the element and click on the edit element button. Once I add space after the src property in the html code (see below for bet...

JavaScript Add Class When Link is Clicked

Hi, I have these links: <a class="active" href="#section1">Link 1</a> <a href="#section2">Link 2</a> When a link 2 is clicked I would like it to receive the active class and remove the class from link 1 itself so it would effectively become: <a href="#section1">Link 1</a> <a class="active" href="#section2">Link 2</a> This should...

How to call a server side function on Leave event of a ASP.Net TextBox.

I am building a user registration form in asp.net. I want to check if the username is available or not on the leave event of the TextBox. I am not able to get the Leave Event of the TextBox. Should I use OnBlur event of the Html TextBox. Please Help. ...