javascript

Replace all line break in a string with <br /> tag in javascript

Exact duplicate: Read line break in a string with javascript Does anyone know how I can read the line break from a value with javascript and replace all the line breank with br tag? Example: A Variable passed from php as below: "This is man. Man like dog. Man like to drink. Man is the king." I would like my...

Is there a way to make jQuery ignore child elements already hidden with slideDown()?

On my website, I use some simple jQuery to slide down and up an existing element. $('#menu li:first strong').bind('click', function() { var searchBox = $(this).parent().find('form'); if (searchBox.is(':hidden')) { //$('#menu #advanced-search-block').hide(); searchBox.slideDown(10...

Convert special characters to HTML in Javascript

Does any one know how to convert special characters to HTML in Javascript? Example: '&' (ampersand) becomes '&amp' '"' (double quote) becomes '&quot' when ENT_NOQUOTES is not set. ''' (single quote) becomes '&#039' only when ENT_QUOTES is set. '<' (less than) becomes '&lt' '>' (greater than) becomes '&gt' ...

Modal dialog options

I am opening a window as a modal. window.showModalDialog("http://www.google.com","","dialogWidth:500px;dialogHeight:500px") as I set height, what are other options available? Like option buttons, menus etc. where I can find tutorials? EDIT It works in Mozilla firefox, but people are saying it doesn't! My code is Please somebody...

Load dropdown according to the value of another dropdown - without refreshing the page in PHP

Hi Friends, I have created a page in PHP, in that i need to load a dropdown2 corresponding to the value of dropdown1 without refreshing the page. The values for those dropdown's are from the database. I dont want to refresh the page for every click, Please guide me regarding this.. ...

solution for popup page as modal

I was using window.showModalDialog() but doesn't work on all browsers. People recommends me jquery, thickbox and also this contact Example but the problem is when i submit the page, server will send me another page, and that page will replace my original page! so actually it doesn't fulfill my requirement. My requirement is on button...

What is the !! operator in JavaScript?

I've seen code that seems to use an operator I don't recognize, in the form of two exclamation points, like so: !!. Can someone please tell me what this operator does? ...

Change radio button name javascript not working in IE

I have a few radiobuttons in a jsp page. I run a javascript method once the page is loaded that seeks for certain radio buttons and change its name so they work like a radio group. I'm doing it this way because the radio buttons are inside jsf table and I have no access to the name property when coding and I want all of the radio butto...

jQuery validation error position

In jQuery error indication from jQuery.validate show near the input field and if this message shows our layout crashed. I need solution based on flow "div" with z-index and error message show over the page and near the input field. Thanks ...

JavaScript tag is generating break in HTML code

I got this JavaScript tag which is displaying a banner on my page: <script src="http://e2.emediate.se/eas?cu=10524;cre=mu;js=y" language="JavaScript" type="text/javascript"></script> <embed height="150" width="768" type="application/x-shockwave-flash" src="http://e2.emediate.se/media.2/170/4045/32676/49312404-768-150....

Fastest way to access a node

I have about thousand DIV tags structured this way: <div id="1"> <div class="1"></div> <div class="2"></div> ... </div> <div id="2"> <div class="1"></div> <div class="2"></div> ... </div> If I want to now access a particular node, say 'div#10 div.5' - what is the fastest way to do it using javascript DOM trave...

Create CallOut using Javascript CSS and Div

I need to create a callout using Div which can popup when some validation goes wrong. I am working 1.1 framework so AjaxControlToolkit is out of question. I have even tried one sample provided at dailycoding.com. I hope there is some solution to it. ...

Dynamically coloring a US map with Javascript

I need to write a webpage which starts with a blank map of the US and colors the states according to data it receives from various Ajax requests. The map needs to change over time without the page reloading, and the user can click on various controls to instantly change how the map is colored. This all needs to be done locally, so I ca...

Error when calling webservice with jquery

I have read a lot about jquery and i have a webservice where i convert a companyID to the real companyName. Now i want to call that webservice with jquery or javascript. The webservice is on host http://webservice/service.asmx en i'm working on http://tlmos. I don't work and i always get an error Here is my code: <script type="text/jav...

Web: solution for image rotate and zoom

I have a web page which displays a large image, for example a page from a magazine. I have no control over the image size or orientation. It's possible that the image may need to be rotated by the user to orient it correctly. Are there any Javascript or Flash solutions that will allow someone to rotate and zoom a given image? Ideally I'...

Why are string lengths different between JavaScript and VB.NET (posted back via ASP.NET form)?

When I trim a multi-line textarea in JavaScript to a certain length (JS: .substring(0, x)), and that field is then posted back, checking the length in VB.NET will still find a length greater than the trim length from JavaScript (VB: .Length > x). I have already determined this was a problem with line breaks, but I wanted to make sure no...

Disabling controls within a table - JQuery/Javascript

I have a complex UI with several nested tables, a repeater control and several other HTML controls that have their disable attribute set based on business logic in JQuery. I need a way to disable the entire table (including nested controls, UI elements etc) and re-enable them when a user toggles a button. I could iterate through the c...

iframe back button problem (don't want back button to affect iframe)

Hi, I have a pretty simple problem which I have not been able to fix myself (I am having trouble manipulating iframes). Basically, go to say this page.... http://andrew.koallo.ca/new/393NelsonSt-JordanFisher click on "Click here to Map"...and a map should load up for you....now if you his back once...it will only take back the iframe...

Javascript key press buffer issue.

I have a function which starts to gobble up keys after a hot key is pressed and fires off an AJAX process at the end of a sequence (barcode scan). The issue is what happens if the user accidentally presses the hot key? My paper napkin solution was: on hotkey: if(okay(true)) {buffer=""; ts=now(); consumekey();} on EOTkey: if(okay(false...

Using Youtube's javascript API with jQuery

I'm currently trying to use the YouTube API as part of a jQuery plugin and I've run into a bit of a problem. The way the YT api works is that you load the flash player and, when it's ready it will send a call back to a global function called onYouTubePlayerReady(playerId). You can then use that id combined with getElementById(playerId) ...