javascript

Javascript: passing an object to a setTimeout function inside a loop

I'm trying to write some JS replicating jQuery's fadeIn and fadeOut functions. Here's the code I have so far: function fadeIn(elem, d, callback) { var duration = d || 1000; var steps = Math.floor(duration / 50); setOpacity(elem,0); elem.style.display = ''; for (var i = 1; i <= steps; i++) { console.log(i...

Dynamically changing images in a div

I've five images and would like to display it in a same div one by one with interval of 2 sec. Can anyone please suggest any solution for this? ...

HTML5 Canvas: globalCompositeOperation (eraser)

How can I use globalCompositeOperation for erasing something? http://canvaspaint.org/ has an eraser, but that's just a white line - ok only if your background is white... I know you can use ctx.clearRect(). But it didn't really worked for me because while dragging a mouse with eraser (set to 8x8px) it only makes unconnected 8x8px squa...

javascript method is called 2 times

I am adding jQuery and swf library dynamically, onloading these libraries i am calling a method but the method is called twice, it works fine on local but on website it(methodCall()) fires 2 times. function importJS(src, look_for, onload) { //if already exists if (eval("typeof " + look_for) != 'undefined'){ wait_for_scri...

jQuery AJAX - Return dynamic content

Hello, I am making a jQuery Ajax form submit to a PHP page that I want to return values dynamically instead of all at once. For example, if my jQuery code is: jQuery.ajax({ type: "POST", url: "$PathToActions/Accounts.php", dataType: "html", data: "action=register&accounts=" + accounts, success: function(re...

remove flash object border

I am embedding swf object into my html document, but its showing border on top and left of swf object, how to remove it? Same result on all browsers. If i increase the dimensions of swf object then border start appearing on all sides. I dont want the border at all. ...

jQuery li clicked id and value

<ul id='myid' > <li>Microsft Office</li> <li>Microsft windows XP</li> <li>Microsft windows Vista</li> <li>Microsft windows 7</li> <li>Microsft windows server 2003</li> </ul> <input type='button' id='mybutton' value='submit' disabled > jquery $("#myid").click(function(){ $("#mybutton").attr("disabled", false);...

jQuery show/hide problems

Hello I'm quite new to using jQuery and I was trying to create a menu that showed different pictures when you moused over the links. It will show one picture and hide 4 others and when you mouse off a link it will go back to a default picture. I'm using the hover function but sometimes when I moved the mouse to the bottom both images (th...

What is causing these browser rendering issues? Z-index conflicts? Positioning rules?

I'm developing a product to be used by a number of customers alongside our Web application. Quick background: These customers have incorporated into their pages a widget that we've developed. The widget's content can be modified by using our application. The idea behind this product is a bookmarklet that we supply, which will "highlig...

How to add rows to a repeater in client side

I have a Repeater and also a Button. If I click on my button a new rows need to be created to the repeater in client side (javascript). I am able to do this with server side, but want to avoid a postback. I am not using an Ajax Updatepanel control. Moreover I am using a table structure in my Repeater. ...

Escape string for use in Javascript regex

I am trying to build a javascript regex based on user input: function FindString(input) { var reg = new RegExp('' + input + ''); // [snip] perform search } But the regex will not work correctly when the user input contains a ? or * because they are interpreted as regex specials. In fact, if the user puts an unbalanced ( or [ ...

Why doesn't this work in asp.net?

I used this, <a title="Logout" onclick="javascript:document.getElementById('ctl00_ContentPlaceHolder1_LbLogout').click();" href="#" class="logout">Logout</a></li> <asp:LinkButton ID="LbLogout" runat="server" style="display:none" onclick="LbLogout_Click">Sign out</asp:LinkButton> The anchor tag doesn't seem to fire my linkbuttons on...

How can I count the number of newline characters at the end of a string in javascript?

For example I have a string that looks like the following: var example_string = "this is the example string\n <-don't want \n\n\n"; Here I've made a string that has four newline characters in it, with three consecutive on the end. How can I programmatically have javascript tell me that there are 3 newline characters on the end? ...

Javascript text input fields that display instruction text

What's the best way to have a text input field that displays instructions of what to enter in that field in gray. When you focus on that input field, the gray instruction text disappears and your input text appears black. If you erase your input text and focus away from that input, then the instruction gray text reappears. I've tried ...

how to remove an item in a javascript array with json form

hello, i have this json structure and I made it into an array. I was trying to remove the entry, but this code failed on me: http://stackoverflow.com/questions/1728727/remove-item-from-array-if-it-exists-in-a-disallowed-words-array var historyList = []; // assuming this already has the array filled function add() { var newHistory...

Interspire Template

In Interspire I copy a template & paste it then rename it & I customize it according to my theme but when i go into admin & in admin when i click on design mode then there should be site open for making changes but in my new template it is not open in proper way & I am not be able make changes in this mode please tell me why it is ...

get form object from outside <form> tags

I want to grab a form object from an external javascript function instead of passing it from a submit button inside the tags. So for example lets say my form is: <form id="form1"> //inputs... </form> Normally I would just put a button in there with onClick="submitFunction(this.form)" to pass it to my javascript function, however no...

javascript: insert large CSS string in one go, into every DOM element

This is a two part question - first I need to get every element that is a child (or subchild, etc) of a parent element, and then I need to reset it's style. As such, I'm looking to do something like the following: var everything = parent.getEveryElementBelowThisOne(); for (i=0; i<everything.length; i++) everything[i].css = "font: 10...

Selecting folders, not files, in Google Chrome

Hello there, I'm creating an extension for Google Chrome, so any code has to be compatible with Chrome and Chrome only. In this extension, I need the user to select a folder from his local machine. This simple task is becoming quite a problem. The chrome extensions options page will not run applets, so I couldn't really do Java. It's Goo...

How can I profile setTimeout functions existance in JS

Hi I am having a problem understanding which function runs (probably in infinite loop) in my JS code. Is there a plug\way to see the list of the setTimeout functions that are running? thank you ...