javascript

How to call a function within $(document).ready from outside it

How do you call function lol() from outside the $(document).ready() for example: $(document).ready(function(){ function lol(){ alert('lol'); } }); Tried: $(document).ready(function(){ lol(); }); And simply: lol(); It must be called within an outside javascript like: function dostuff(url){ lol(); // call ...

What's a good approach to separate JavaScript-based plugins and configurations for performance improvement

Hi! I'm working on a high traffic web application that uses increasingly more JavaScript-based plugins. Improving and keeping front-end performance at high levels is a great concern for me. I want to rearchitect the way plugins and specific plugin configurations are included in the page. Currently some plugins are merged into a monolit...

Display a div within view port

I've an image gallery, that displays images in a 5X5 matrix. Each image has a onmouseover function where in a hidden div is displayed with some details about the image and the div with the details gets hidden using onmouseout. The div that contains the details about the image may contain clickable links and hence I am displaying the div ...

What's the foreach equivalent in jQuery (JavaScript) to parse through a JSON object and return key/value pairs?

That's it folks.. any ideas? ...

Javascript on different platforms

I've got a simple js script that scrolls image horizontaly. the strange thing is, it loads CPU up to 100% on windows, while on linux the CPU load rarely reaches 20% on the same computer. I've tested this in firefox, chrome and opera on both platforms — results are practically the same. Can someone explain what's going on? <script> v...

Force wmode on flash content with javascript

Hello there. I'm using a modal window on a client's site where we have no access to the content. The problem is that he has some flash on the page and the wmode for these is not set to transparent. Is there a possibility to force their flash from our javascript to have this parameter added? Thanks ...

How can I programmatically scrape an image from another website?

A few years ago I helped someone put together a webpage (for local personal use only, not served to the world) that aggregates outdoor webcam photos from several of his favorite websites. It's a time-saver for viewing multiple websites at once. We had it easy when the images on those websites had fixed URLs. And we were able to write ...

Jquery to hide table cell contents

I have a table that is laid out like this: <table> <tr> <td>checkbox</td> <td>text-text-text</td> <td>dropdownlist</td> <td>textbox</td> </tr> </table> I'm trying to toggle visiblity of the dropdown list and textbox based on the check status of the checkbox. I've got a click event set up that does this correctly, ...

Limiting characters to a fixed size in javascript

In the below code var panel= '<div id="title" style="display:inline;font-size:150%;color:white;background:transparent;text-transform: none;width:150px;"> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div> <div name="images" id="name" style="display:inline;position: absolute; margin-left: auto;margin-right:auto;left: 0;right: 0;width:350px;hei...

how to invoke click event from javascript?

hi, Below is my asp(HTML) code <a id="More_Info" onclick ="window.top.location.href ='More_Info.asp?ussl=H&Start=<%=nRecCount%>&RS=<%=RecordStart%>;'" href="#"> from my javascript i wand to activate the onclick ="window.top.location.href ='More_Info.asp?ussl=H&Start=<%=nRecCount%>&RS=<%=RecordStart%>;'" onclick event... <script type...

how to pass HTML DOM for windows sidebar?

I am trying to play multiple videos one after the other in windows sidebar. I'm using javascript setInterval method to change the video. But windows sidebar doesn't parse javascript. Can anyone help me, please. ...

Generate 8 unique random numbers between 1 and 100

Hey guys, i have trouble generating unique random numbers using js. Can someone lend me a hand? ...

HTMLPurify - Disable Javascript

I use HTMLPurify for disabling JavasSript in a textarea. My problem is: $config = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier(); $va = $purifier->purify($va); This removes script tags, but does not remove [a href='javascript:...']link[/a] What should I do to remove the bad links and retain good links? ...

How to develop this feature with Javascript?

What I want to achieve is as follows: For example, there is a symbol which represents a table on a web page, a user can drag this element to any place on the web page, when the user looses the cursor, a dialogue box will pop up to ask the user to input values of attributes, for example,the number of columns, the number of rows, after th...

How to scroll from one href to href inside iframe ?

hi below is my main page html <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Page_1.htm</title> </head> <body> <a href="#My_iframe_Link">Click me</a> <br></br> <br></br> <br></br> <br></br> <br></br> <br></br> <br></br> <br></br> <br></br> <br></br> <br></br> <br></br> <iframe name="I1" ...

post-it notes in AJAX

I need to create an AJAX widget that would allow a user to simply click on a box and begin typing a few notes. I can take care of the save and edit code. Anyone know of a quick and painless way of going about this? ...

Why does jquery need _$ in case of overwrite?

var // Will speed up references to window, and allows munging its name. window = this, // Will speed up references to undefined, and allows munging its name. undefined, // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$, jQuery = window.jQuery = window.$ = function( sel...

How to make a mysite profile property display in a different way?

Hello, We have a string in AD which is actually storing a date in the YYYYMMDD format, which when you map it in sharepoint to a profile property, just looks plain ugly, e.g. 20091130. Our AD people are refusing to change the format of it in AD, so we were wondering if there was a way (javascript perhaps?) of changing it so that it at le...

Using Google Maps API to dynamically embed a map based on an address - Need to use Google's data for the markers/bubbles

Hello, I am trying to embed a Google Map into a dynamic webpage. The only variable the map depends on is the address of a business. That address comes from the website's database. I cannot just statically generate embed code for each dynamic page using the same set up. Is there a way I can embed a map based on that address and show a ma...

jQuery .load() does not load plug-ins

I have a main page with 2 links that load external files via .load(). The first file has a simple JavaScript rollover, which works when the content is loaded. The second file has a jQuery plug-in that does not work when loaded via .load() - but works fine when the data file is viewed by itself. Main file: http://gator1105.hostgator.com/...