javascript

JQuery not loading on first page visit

Hi all, Im having an issue loading the JQuery library when I visit my webpage for the first time.. therefore none of its functions work...If i visit another page on my site, or reload it , the script works and continues to from there on... and to recreate the issue, I have to clear my cookies....I have checked my code and it seems fine...

Javascript Highlight Selected Range Button

I'm attempting to create a study tool for a page that allows a user to select any text on the page and click a button. This click then formats the selected text with a yellow background. I can make this work inside of a single tag, but if the range of selection is across multiple tags (for instance, the first LI in an unordered list al...

Simple jQuery .each problem

I have a UL with 9 anchor tags, each with the class 'highlight'. Here is a bit of Javascript with jQuery: var titles = $('a.highlight'); jQuery.each(titles, alert(titles.length)); What I expect this bit of code to do: Alert 9 times, the number 9. What this bit of code actually does: Alerts 1 time the number 9. What am I missing...

What is a non intrusive history back button or alternative if Javascript is disabled?

If JavaScript is disabled what's a way of linking to the previous document in the session history? Can PHP be used to simply link to the REFERRER or is there a better alternative? Edit: Further to this, can previous post variables be retained? ...

Javascript + jQuery, click handler returning false to stop browser from following link

I'm trying to stop the browser from following certain links, rather I want to unhide some Divs when they are clicked. I'm having trouble just getting the links to not be followed though. Here's what I have: var titles = $('a.highlight'); jquery.each(titles, function(){ this.click(function(){ return false; ...

How to find the snippet of JavaScript that modifies an element?

The page I'm trying inspect has a hidden <input type="hidden" name="Foo" value="123 /> element on a page, where Javascript/AJAX modifies the value. I'm trying to find where on earth in Javascript is the code that modifies this value from time to time. Is there a tool that could help me find the places in javascript that use/modify that ...

how to get the highest resolution timeout from prototype (like scriptaculous)

What is the timing method and interval that scriptaculous uses in prototype for its smooth tweening? PeriodicalExecuter? ...

Can I see the resulting markup after JavaScript Dom manipulation?

Is there any way to get a browser (or some other program) to show me the DOM of a web page, as modified by JavaScript code? For example, say I have some simple markup. I then use some JavaScript (say, via jQuery) to add classes, move things around, etc. Is there any way to "view source" on the modified version, as it would look if that ...

How to ignore \n\t when AJAX reading a text file?

I can use the AJAX call to read a text file, but the problem is it read the \n\t, and the symbol '\' (Backslash), it is not necessary for me, How can I ignore it to pure text msg....? ...

Javascript how to know if an array is subarray of another

How could I do the following in javascript in efficient way? I've counter of 7 items(item0, item1, item2...item6) in order.. like in counts = [0,2,0,5,6,0,9]; There are 3 mutually exclusive groups: group1: item0, item1, item2 group2: item3, 4, 5 group3: item6 A group is considered selected if and only if counters of the group member ...

detect users' operation on browsers

How to use javascript to detect users operation on browsers such as click backward/forward/refresh button, keyboard inputs in navigation bar or search bar of Firefox, as well as any hotkeys for these operations. Thanks! Paul ...

PHP -> JavaScript

Here is my PHP code.. $input = "zergling-light" $output = str_replace('-', ' (', $input).")"; $output = strtoupper(substr($input, 0, 1)).substr($input, 1); echo $output; // Prints.. Zergling (light) ..I'm extremely crappy with my JavaScript code, could someone help me convert this? I basically want to convert a variable such as "marin...

Want to show Thumbnail Images on client client

Hi, In the below picture there are some thunmnail and large picture, when user click on the thumbnail, I want to show large picture like in the in picture there is big image. I am looking for some javascript library/solution to accomplish this. Thanks ...

how to find a number in a string using javascript.

Suppose i have a string like - "you can enter maximum 500 choices". So extract 500 from the string. The main problem is the String may vary like "you can enter maximum 12500 choices". So how to get the integer part. ...

Trigger click on embedded PDF

I have a PDF embedded in a web page using the following code: <object id="pdfviewer" data='test_full.pdf#page=1&toolbar=0&statusbar=0&messages=0&navpanes=0' type='application/pdf' width='500px' height='350px'> The PDF itself is set to open in full screen mode which shows no controls. The user can advance the...

How to skip the method if the event is generated from specified button?

This is in continuation of http://stackoverflow.com/questions/1613744/how-to-attach-an-event-to-onsubmit-event-of-form-with-chaining-earlier-attached-m Now, i am having disablePage method which will be executed every time there is any submit event occurs. But i don't want this method to execute if the event is generated from export bu...

How to trace and debug IE's javascript error in firefox?

If I am using many js files in my project and get JavaScript errors in IE 6 or 7's status bar, then how can I trace, find and solve those errors in Firefox? I know how to trace a problem in IE with visual studio but can we identify area of problem using Firefox? ...

Form submit with javascript works in Google Chrome only once

I have simple form. <form target="_blank" action="somescript.php" method="Post" id="simpleForm"> <input type="hidden" name="url" value="http://..."&gt; <input type="hidden" name="code" value="wrxosf"> </form> ...and there are some anchor link <a href="#" onclick="$('#simpleForm').submit();return false;">Do it!</a> It works fine in ...

Copying plain text from a WYSIWYGI to a normal textarea?

I know I did ask this question earlier but here is my problem in details: if I copy the text from textarea1 to textarea2 using a JavaScript program, it works fine if I attach the teaxtarea1 with a WYSIWYG editor then it refuses to work. And I am using openWYSIWYG. Why can't I can copy the plain text from textarea1 when it is attached...

How to extract a GET parameter from the URL in Javascript?

Suppose I have this url: s = 'http://mydomain.com/?q=microsoft&amp;p=next' In this case, how do I extract "microsoft" from the string? I know that in python, it would be: new_s = s[s.find('?q=')+len('?q='):s.find('&',s.find('?q='))] ...