javascript

How can I stop parent events from firing?

If I have... <div id="parent" onmouseover="doSomething()"> <div id="child" onmouseover="doSomethingElse()"> </div> </div> How can I make it so that doSomething() is not executed when I'm hovering over the child? I only want doSomethingElse() to execute when I'm hovering over the child, and I only want doSomething() to execute ...

Load URL from text box into iframe

How do you load a URL from a text box into iframe in a HTML file via javascript? ...

Fast clicks on nav menu causing fadeIn of multiple divs

I'm having an issue with a script (my first try at jQuery) I wrote to fade in divs using a nav menu. If a user clicks different buttons on the nav menu quickly, it loads both divs over top of each other. Here is the code: $(document).ready(function(){ $("#about-button").css({ opacity: 0.3 }); $("#contact-butto...

Is this how you define a function in jquery?

Is this how you define a function in jQuery? $(document).ready( function () { var MyBlah = function($blah) { alert($blah); }; }); Now to call the function I do: MyBlah('hello'); ...

capture right click through Javascript, withouth wmode

Flash player has a bug in using anything other than wmode="window" in Firefox/Chrome when using any other language than English. This bug is reported and not fixed yet http://bugs.adobe.com/jira/browse/FP-501 The issue can be seen better here - http://www.5etdemi.com/blog/archives/2005/06/firefox-wmodetransparent-is-completely-screw...

How can I verify if a function was defined in JavaScript?

How can I verify if a function was defined already? Will this work? if(window.opener.MyFunctionBlah) { ... } ...

How to set ie margins with javascript or vbscript or jquery?

I want to get print out invoice but also wanna set margins and page size with javascript or vbscript or anything else. is there any tutorial about that ? and would you share something about ie8 to get print out easly? ...

asp:HiddenField value set client-side, not received server-side [please delete!]

Stop Press! This question is misleading; the code below works; the problem is unrelated. Please vote to delete. For those interested I had a self-closing <div/> that Chrome didn't like. It works fine with a <div> and </div>. I don't know if this affects other browsers, yet. Going round in circles here! I have an asp:HiddenField in m...

Google Maps: Why does MarkerClusterer not work?

Hello! At first I want to say: I couldn't find a support forum for this library so I would like to try it here. I hope such questions are allowed here and the link to my page needn't be removed. The link is only for seeing how it works and which parts don't work. Please don't remove it. Now to the question :) I want to use the library...

javascript securty: an AJAX call to record the user's screen resolution, is it possible to prevent fake numbers?

This is a javascript security question: suppose a page finds out the screen resolution of the computer, such as 1024 x 768, and want to use an AJAX call to log this data into the DB. Is there a way to actually prevent fake data from being entered into the DB? I think whatever the HTML or Javascript does, the user can reverse engineer ...

jQuery UI multiple selections

Hello see this demo from jquery ui you have to hold down the Ctrl key to make multiple selections I really like the code but I don't want to force my visitor to press ctrl key I want the code to allow multiple selections without holding ctrl key is this possible? ...

How can I know if a javascript file has already been included in a top-level page?

I have a user control (ascx), in this user control I wanna use a .js file. So I include on top of it. On the other hand, sometimes I use this user control in a webpage that this script has already been loaded on it before. How can I make a declaration and make it actual only if the page doesn't contain another tag for this script? ...

How to get the parent element in an HTML string at a given offset?

New Question I am looking for a way in Javascript to get the parent element of a given position in an HTML string (e.g. document.innerHTML or document.body.innerHTML). Simple example: <p>I really <em>like <a href="...">stackoverflow</a></em> a lot.</p> ^...........^ Off...

Tips on managing large amounts of code?

My project seems to be getting bigger and bigger and some of my classes are thousands of lines long, it's too hard to search through them every time I want to make changes. I find javascript is not as easy to lay out cleanly as some other programming languages. So when the classes get to be a few thousand lines, I have troubles reading ...

Tips on optimizing javascript

The things I'm trying to get my website to do are getting fairly complex, some of the things that need to be done take long enough that it gives visible delays. Mainly, adding content to the document slows things down as well as jquery animations that I'm using. I create elements using document.createElement("div") rather than just doi...

how to remove "," from a string in javascript

original string is "a,d,k" I want to remove all "," and make it to "adk". I tried: "a,d,k".replace(/,/,"") but it doesn't work. Thanks in advance. ...

Overlay div "edit image" on a div, td element

I have either a div element, or td element in a table that is editable, i.e. you click the element and popup lets you edit the text. I would like to be able to add an "edit image" in the top left hand corner of the editable element. At the moment, all I have is when you rollover the element, the background changes to yellow to indicate. ...

How to pass multiple checkboxes using jQuery ajax post

Hello How to pass multiple checkboxes using jQuery ajax post this is the ajax function function submit_form(){ $.post("ajax.php", { selectedcheckboxes:user_ids, confirm:"true" }, function(data){ $("#lightbox").html(data); }); } and this is my form <form> <input type='checkbox' name='user_ids[]' value='1'id='checkbox_1' /...

Drawing an Interactive Diagram.

My boss wants to draw the local network and then, if you click on one of the computers or roll the mouse over one, he wants to see stuff like RAM, CPU, OS, etc. This has to be done in a browser, more specifically, the intranet's wiki. One of my coworkers suggested using flash (I am a complete noob but I assume ActionScript is what would...

regex for changing height and width value in an embed code

HI I have an application where users can paste their embed code.While displaying I want to change the height and width of the embed code to a fixed value of my choice. Can you tell me the regular expression to find the width and height in the embed code. width="300" height="500". I want to be able to get these two values completely so t...