javascript

what basic tips should we observe in design web pages(html/css/javascript) for having highest compatibility with all browsers?

hi all what basic tips should we observe in design web pages(html/css/javascript) for having highest compatibility with most browsers(IE-firefox-opera-chrome-safari)? thanks ...

JS/Jquery, Match not finding the PNG = match('/gif|jpg|jpeg|png/')

I have the following code which I use to match fancybox possible elements: $('a.grouped_elements').each(function(){ var elem = $(this); // Convert everything to lower case to match smart if(elem.attr('href').toLowerCase().match('/gif|jpg|jpeg|png/') != null) { elem.fancybox(); } }); It works great with JPGs but...

How to replace a div container with javascript

Hi, I must have a little design in javascript. I have a menu with 5 entrys and only 1 HTML-page. So I will have a content-div and enabled and disabled different static content in it, each menu-entry is another content. I tried with 5 divs and disable 4 of them and enable 1, but the element under each other means every div is like a ...

javascript multiline regexp replace

"foo\r\nbar".replace(/(foo).+/m, "bar") Hello. I can not understand why this code does not replace foo on bar ...

Are JavaScript arrays associative?

For instance, if I do a[1000000]=1; will it use memory for 1000000 elements or just for this one? ...

Genie animation Javascript?

Is there a jQuery plugin or javascript library that supports a "genie" animation effect like the apple Mac OS X dock? Bonus: Actionscript library? C/C++? .NET? Objective C? ...

Anyone knows from where to get that jQuery tags editor?

Hi, Someday i've downloaded a very nice jquery editor but i lost it and i only have a screenshot of it. You just type a tag and press return or space and it's will be inside a nice box, and you can delete it by only pressing the backspace key or the close icon. Please don't suggest me That because it's so poor and the tags are insert...

GWT: Editing Text Of Tree Item

Hi All. When a user clicks a 'Add Node' button above a tree and the program adds a tree item below the selected node, I would like to insert the new tree item with the text highlight and ready for editing by the user... like labels in GMail. Any ideas? --Kirt ...

Using jsDoc in Notepad++

Hi, I use notepad++ for my JavaScript development now. I am wondering if anyone has successfully integrated jsDoc with notepad++ for easy code commenting. I was usint Aptana earlier and it was already integrated in it as ScriptDoc I believe but Aptana grew out to be painfully slow. ...

Dynamic paging using divs and Javascript

I have a recordset loop that creates a table, and every 9 items it wraps a div around them so basically looks like: <div> <table>rs1, rs2 ----> rs9</table> </div> <div> <table>rs10, rs11 ----> rs18</table> </div> etc... Now, I want it so at first only the first div is showing and the others are hidden, but I have ASP loop that genera...

What libraries are available to record a user browsing your website for usability testing?

I remember seeing a JavaScript library a long time ago that offered the ability to record where users clicked and moved their mouse on your website, in order to do usability testing. I can't seem to find it anymore. Are there any libraries out there that do something like this? What I'm looking for is something like http://clixpy.com/,...

Javascript scrollTo(x,y) not working for me.

I am trying to position the page to a specific location after user clicks on a link. I am using javascript scrollTo(), but it is not working for me. Need advice or alternative way of doing this. I think the GEvent.trigger function is causing conflict or firing after scrollto. Try this link. http://tinyurl.com/ye5khug select Edmonton o...

JavaScript to detect if the parent frame is of the same origin?

I'm looking for a cross-browser way to detect whether the parent frame is the same origin as my frame, preferably without printing warnings on the JavaScript error console. The following seems to work but I'd like to avoid printing errors to the console (at least Safari and Chrome do when accessing location.href on the parent frame. Fir...

Are you as productive in Javascript as you are in .Net or Java?

I code primarily in javascript and in vb.net. I've found that if I can achieve the same thing in both javascript and vb.net that I feel far more productive and expressive using javascript for the task. I often find myself researching server-side javascript implementations to see if anything has gone mainstream so that I can code my bac...

Why do people have to use multiple versions of jQuery on the same page?

I have noticed that sometimes people have to use multiple versions of jQuery in the same page (See question 1 and question 2). I assume people have to carry old versions of jQuery because some pieces of their code is based on an older version of jQuery. Obviously, this approach causes inefficiency. The ideal solution is to refactor the o...

jQuery code to delete all spans with same content but keep one

Hello, Say i have the following html: <span class="fruit">Apple</span> <span class="fruit">banana</span> <span class="fruit">Apple</span> <span class="fruit">Apple</span> <span class="fruit">orange</span> I tried different methods but it didn't work, I want a jQuery code to remove all (.fruit) spans with same content but keep one (th...

Javascript : assign variable in if condition statement, good practice or not?

Hi all: I moved one years ago from classic OO languages such like Java to Javascript. The following code is definitely not recommended (or even not correct) in Java: if(dayNumber = getClickedDayNumber(dayInfo)) { alert("day number found : " + dayNumber); } function getClickedDayNumber(dayInfo) { dayNumber = dayInfo.indexOf("fc-...

How to prevent direct access to my JSON service?

I have a JSON web service to return home markers to be displayed on my Google Map. Essentially, http://example.com calls the web service to find out the location of all map markers to display like so: http://example.com/json/?zipcode=12345 And it returns a JSON string such as: {"address": "321 Main St, Mountain View, CA, USA", ...} ...

Creating a notification system using a firefox extension

I am creating a firefox extension that should give a notification when the user hits specific sites. I do not want the same kind of notification that firefox gives for pop-ups. I don't want the user to have to go through the hassle of clicking the X in order to close the notification. Instead, I would like it to look like what happens wh...

What's the cross-browser way to capture all single clicks on a button?

What's the best way to execute a function exactly once every time a button is clicked, regardless of click speed and browser? Simply binding a "click" handler works perfectly in all browsers except IE. In IE, when the user clicks too fast, only "dblclick" fires, so the "click" handler is never executed. Other browsers trigger both eve...