javascript

display of duplicate records in firefox

hi I am working on an online music store. There are buttons like myplaylists, mydownloads etc... On clicking on these buttons, a list of songs appears accordingly in a grid view. The problem is that when i click on the buttons twice quickly the list appears two times like 1..4..8 1..4..8 and if i click thrice quickly it happens three ti...

Any issues with using innerHTML to load up an iframe?

My app (under development) uses Safari 4.0.3 and JavaScript to present its front end to the user. The backend is PHP and SQLite. This is under OS X 10.5.8. The app will from time to time receive chunks of HTML to present to the user. Each chunk is the body of an email received, and as such one has no control over the quality of the HTML...

JavaScript Image Popup Window

I would like to setup my gallery web page so that when a user clicks on the thumbnail image, a window pops up displaying a larger view of the image. I do not mean a pop up window as in a browser window but a window that is loaded within that same page and can be closed. I am not exactly sure how I would go about doing this. Any ideas?...

How do I change YUI Autocomplete textfield Value population Options?

Data: JACKSON, MS 39212|39212 BAINVILLE, MT 59212|59212 CROOKSTON, NE 69212|69212 COLUMBIA, SC 29212|29212 SPOKANE, WA 99212|99212 Code: <form method="GET" target="_blank"> <fieldset><legend>remote example</legend> <label for="myRemoteInput">Enter a state:</label> <div id="myRemoteAutoComplete"> ...

jQuery scope for parent ID

Hi! I was wondering how I would go about implementing this: <div id="1234345" class="item"> <script type="text/javascript"> function getItem() { alert($(this).attr('id')); // I want this to be 1234345 } getItem(); </script> </div> <div id="1239345" class="item"> <script type="text/javascript"> function getItem() { alert($(this).attr('i...

Regular expression to lower a case

i'm retrieving the innerHTML in javascript let say element.innerHTML where all the tag are in Capital. i need to lower only the tag. using Regex or any inbuild methods.. ...

accessing variables and methods of parent javascript object?

var SortingTable = new Class({ initialize: function( table, options ) { this.table=$(table); this.tbody = this.table.getElement('tbody'); //...do alot of things here... }, addTextInput : function(index,headid,options){ var trs = this.tbody.getChildren()...

Blur a select after change in Internet Explorer 6

Simple question really. This works in all but IE6: <html> <body> </body> <select id="test" onchange="blur()"> <option name="one">One</option> <option name="two">Two</option> <option name="three">Three</option> </select> </html> Is there anyway to get this working in IE6? JavaScript and JQuery hacks allowed. Any ideas, remarks or tip...

HTML syntax highlighting in javascript strings in vim

Hello, I don't know if this is possible/sensible, but I was curious to know if I can have my strings in javascript files have html highlighting. I discovered that strings in php could have SQL syntax highlighting, so I believe it is possible. But, I don't know vim-scripting, so any help on this appreciated. I am using the Better Javas...

how to get selected text from iframe with javascript ?

<html> <body> <script type="text/javascript"> function smth() { if (document.getSelection) { var str = document.getSelection(); if (window.RegExp) { var regstr = unescape("%20%20%20%20%20"); var regexp = new RegExp(regstr, "g"); str = str.replace(regexp, ""); } } else if (document.selectio...

Free TextBox problem

hi every body i just can't get rid of such .... error i'm using a free textbox control on my page that is hidden by setting css properties to "none" i want to make this free textbox available for edit whenever a user clicks on another button actually by setting style.. to "block" without postingback my page the result is showing the te...

PHP publishing a javascript

I have a PHP script that publishes a customised javascript based on the parameter, with header type as text/javascript. This PHP url is included in src of a script tag. However, there seem to be some issue. That script seems to be non functional.As in, I have a alert inside that, which should be executed immediately after inclusion. Its ...

How to escape only "'" in PHP?

I'm doing something like following to transfer value from PHP to javascript: var str = '<?php echo $v; ?>'; If there is no "'" in $v, it'll just be fine. But in case there is "'" in $v, obviously error will be reported. So far I've only used mysql_real_escape, which is not applicable now. ...

XmlAttribute/XmlElement equivalent for JavaScriptSerializer

Is there an equivalent Attribute that can be placed on object Properties in a .NET Class that would perform the equivalent of XmlElement or XmlAttribute? [XmlRoot("objects")] public class MyObjects: List<MyObject> { } [XmlRoot("object")] public class MyObject { [XmlAttribute("name")] public string Name { get; set; } [XmlAttribute...

Advantages of using Rhino (mozilla's rhino)

I've been reading about Rhino as a useful way to implement JavaScript inside my Java code. After reading for a while, searching in google and here, I couldn't find a real reason for which I would use JavaScript inside Java. Could you point some real world advantages you find on using Rhino for a regular Java application? ...

JavaScript: execute code in a specific context

How I can execute a JavaScript function/piece of code in a specific context which it would see as a global context? This is not the same as changing this (call/apply), this is more like changing 'window'. Basically, if I have the following code: (function() { x.value = 5; return value; })() is there a way to make it work (return 5) w...

Scream of the day - Javascript serialising arrays in different ways...

This is royally annoying me at the moment: Consider an array of 2 values: var myArray = new Array(); myArray.push(21031); myArray.push(21486); When storing this in a cookie using jquery and toJSON, the value of the cookie looks like this: ["21031","21486"] Now consider an array of a single value: var myArray = new Array(); myArra...

Programmatically sending keys to input field?

I'm coding a web-portal for a set top box with a custom keyboard. The keyboard has most of the standard character keys but no backspace! Since there are some other free custom keys, I would like to map one of these to backspace when I'm in an input field or in a text area. The question is: How do I programmatically send a backspace to...

How to disable click events on a parent DOM object without disabling click events on its child DOM object?

I have some HTML like this: <a class="button"> <span> <span> <span class="buttonspan">Content</span> </span> </span> </a> I already have some events on the parent Anchor object. Now I am trying to add a click event on to the child span element and at the same time to disable click events on the pare...

How can I get the variable of outer function in Javascript

If only string is allowed to pass into function process(), what should we do inside the function process() to access the array value. Eval is one of the method, but its usage is not suggested by many people. function demo2(name2) { var alpha = []; alpha["a"] = "test1"; var bravo = []; bravo["a"] = "test2"; function process(name) ...