javascript

javascript not working in firefox

Hi friend! I have a master page which is having Javascript code which looks like this: <script type="text/javascript"> function ClientPrint(str) { alert('before'); PrintControl.RawPrint(str); alert('after'); } </script> And the child form is calling this Javascri...

Calling JavaScript Functions

I am trying to call some javascript functions which I ahve written in some file. Eg. function OpenPopup() { alert("OpenPopUp"); return false; } when I call this from button from OnClientClick = "OpenPopup()" it is not called but when I put this function on MasterPage it is able to call the function. I added this is the ...

how to pass form name dynamically into jquery for validation

hi expert, i'm using jquery for form validation, where when i click save button, the code is as below <input type="submit" value="Save" id="button" name="Save" onClick="save(this,'/Web/controller',this.form);"> and the javascript is as below function save(ele,servlet,formName){ $(document).ready(function() { $("#fmyFormName").valid...

Replicating Codeigniter's humanize() and underscore() function in Javascript

I'm trying to replicate CI's humanize() and underscore() function in Javascript. From the CI documentation, underscore() takes multiple words separated by spaces and underscores them while humanize() takes multiple words separated by underscores and adds spaces between them. The CI implementation looks something like: function unders...

canvas data out of range? problem in FF

I run this code every frame, works great in chrome data[index + 0] = bgData[dis + 0]; data[index + 1] = bgData[dis + 1]; data[index + 2] = bgData[dis + 2]; data[index + 3] = 255; but firefox gives the error: An invalid or illegal string was specified" code: "12 unless I add -1 to each line as below: data[index + 0] = bgData[di...

how to access the dom of a popup in IE8

Once you open a window using window.open, how do you access the dom of the popup ...

Should I always test JS in browser?

I'm a JS beginner. My question is do we always need to use a browser to test JS code? Is there a command prompt compiler/interpreter avilable ? ...

ExtJS. Can i put new cells or rows into rendered panel, with layout : 'table'

For Example: var tablePanel = new Ext.Panel({ border: false, autoScroll: true, layout: 'table', layoutConfig: { columns: maxColumns }, items: items }); Can i add rows or cells to that table? And how can i do that? with method .add or? Thanks. ...

Images in fancybox go out of frame in IE

Fancybox works properly in all other browsers. Only IE can't show it properly. The problem is clearly illustrated in the following screenshots: http://img840.imageshack.us/img840/481/subscreens.jpg I can't figure this out. IE seems to work fluently on fancybox original website's examples. ...

jQuery ui autocomplete - renderItem

I am using _renderItem to modify the result list .data( "autocomplete" )._renderItem = function( ul, item ) { var temp = item.url.substring(16, item.url.length) return $( "<li></li>" ) .data( "item.autocomplete", item ) .append( "<a>" + item.value + "<br>" + item.url + "<br>" + item.descri...

What is the most convenient way to convert HTML to plain text while preserving line breaks (with JavaScript)?

Basically I just need the effect of copying that HTML from browser window and pasting it in a textarea element. For example I want this: <p>Some</p> <div>text<br />Some</div> <div>text</div> to become this: Some text Some text ...

How to detect document.ready in JavaScript?

Possible Duplicate: $(document).ready equivalent without jQuery I have a framework-less javascript that executes on load: function myJs() { // some code } window.load = myJs; But this causes a delay in the execution of the script. I want to be able to execute this script as soon as the document is ready to be manipul...

How to get element by innerText

How to get tag in html page, if I know what text tag contains. E.g.: <a ...>SearchingText</a> ...

Textarea isn't rendering in IE7

Hello, For some reason my textareas are not being show in IE7. I am using checkboxes in a form, and when they clicked, it called a javascript function that opens up a corresponding textarea. It works fine in every other main browser but not in IE7. Here is an example of the code I'm using. The HTML: <input name="areasOfConcern1" typ...

Regex: How to validate that a path does not contain //

I need help to create a regex (for JavaScript .match and PHP preg_match) that validates a unix type absolute path to a file (with international characters such as åäöøæð and so on) so that: /path/to/someWhere is valid /path/tø/sömewhere is valid /path/to//somewhere is invalid path/to/somewhere is invalid /path/to/somewhere/ is invalid ...

How to extract images from a webpage as Facebook does ?

If I insert in my wall a link like this: http://blog.bonsai.tv/news/il-nuovo-vezzo-della-lega-nord-favorire-i-lombardi-alluniversita/ then facebook extract the image in the post and not the first image in the webpage ( not image logo or other little images for example ) !! How facebook does that ? ...

Dependent Selects in prototype

Hi, I have two <select>s with the same <option>s, and I need - using prototype - that when selecting an option in one of them, the same option is removed from the other select and additionally the latter must mantain its previously selected option. Any clues ? Is there a better way than remembering the last item selected, recreate the o...

Show user information on mousehover

Hi, On Mouse-over i wish to show user information such as User Id, User Name, User Location, User Age etc. All this info would be coming from database. As well, this information would be in a rectangular block that would actually come-up on Mouse-over. I am aware that JavaScript could be use to show div (in mouse-over) but don't know h...

What exactly is CDATA and what does it do?

I sometimes notice a CSS or JS code surrounded with <![CDATA[ and ]]> tags. I couldn't find any explanation to this. What does CDATA do? Why is it used by some people and what is it needed for? ...

Include another javascript file

I'm writing a Chrome extension, and want to write one JS file, that provides several expected functions that aren't present in another, then load that other file. I'm after behavior similar to require in Perl, #include in C, or execfile in Python when passing the current modules locals and globals, as though the referenced file was inser...