javascript

Why use window.location in a hyperlink?

I was going through a website I've taken over and came across this section in one of the pages: <a href="javascript:window.location='<%=GetSignOutUrl()%>';"> // img </a> Apparently anyone who has ever used the site without javascript would not be able to log out properly (surprisingly enough, this has never come up). So the first t...

Sitemap xml file; Does the url have to end with an ".htm" ?

I have a website which has .htaccess rewrite rules. And alot of them. This means for example that www.mydomain.com/classifieds/something_very_very_very_very_Very_very_looong.php?id=12345 becomes www.mydomain.com/classifieds/12345 Now, this might be a stupid question, but I must be sure... I have followed several guide...

Rendering loads of data in table format

I have a webpage which display loads of data (say around 1,000) retrieved from the back end and is displayed in a proper HTML table format with proper styling and stuff. Now my question is, I am working on Java based web environment, so inorder to display this laods of data I use JSP and the compiled JSP file when returned from the tomc...

Prototype Ajax.Request never returns

I'm trying to learn Prototype, so I threw together a simple Log-in page, with username and password fields, and a Log-in button. I have a controller class, where I want to put all of my onclick functions. function Controller() { this.logIn = function(){ this.username = Field.getValue("username"); this.password = Fie...

Removing jQuery ajax-added js-files from document again?

Hi My site operates on an ajax "framework". Whenever a user opens a new page, that page loads in the necessary css and js files to view the page properly and adds them to the current document. The js files are loaded like this in jQuery: function getJS(jsfiles) { $.each(jsfiles, function(i, val) { $.getScript(val); }); ...

How do I get local business results using google maps API

Is there any google/Yahoo/Bing API which gives local business results based on a ZIP/GeoCode of a location? If yes, please let me know. If Google Maps has such service, please let me know what where do I get a reference regarding that? ...

Ajax request delimiters for data to be sent

Hi All, I have such an issue var url = "index.php?id=123&sid=321"; $.ajax({ type: "POST", url: "some.php", data: "name=John&url="+url, success: function(msg){ alert( "Data Saved: " + msg ); } Now here we have url which contains an & , but & is used to delimit data variables to be sent to server and so since we have...

Dynamically execute a function in JavaScript

Hi, I would like to call a function whose name I have in a variable. For example: I get the string "pageTracker._trackpageview('/url/page1.page'); " dynamically and assign it to a variable as below var myFunction = pageTracker._trackpageview('/url/page1.page');"; Now when I submit the page I want to execute the function which is i...

What is the purpose of this inside functions?

Javascript compiles this code without error: function test() { property: true; alert('testing'); } test(); // Shows message 'testing' alert(test.property); // Shows 'undefined' Is the content of property accessible in any way? If not, what is the purpose of accepting this code? ...

Portfolio Thumbnail Opacity

Hey guys, I am a designer, creating myself a portfolio. The idea of the portfolio is to lazy-load my work as the user scrolls, and they can use the thumbnails on the left to jump to a project (just using anchors). My question: is there a way to have it so the thumbnails on the right are less opaque unless the user is looking at the par...

Display image on top of another image on rollover

I want to display a zoom image (on mouseover) on top of certain images to imply 'click here to zoom'. I don't want to use a cursor. I'm sure there's a good way to do this with javascript jQuery but I don't know it. Does anyone have any good ideas? ...

XPath choking on entities in Firefox / GreaseMonkey

Hi there. I am writing a fairly basic GreaseMonkey script that locates text in a specific element and then uses that text to do things later. The relevant bits of code are as follows: In the HTML there is a span with the class 'someclass', which contains a small string of text: <span class="someclass">some text</span> Then in the Jav...

How to Show "Radial Menu" jQuery Plugin at the Page Load?!

Hi Guys, I am Not Familiar with JavaScript and i am beginner in Jqyery! I Found RadMenu Pluging from web and want to use it to show my links as a Radial Menu. it is OK but I have a Simple Problem With it. I want to khnow How Can I "Load"(better to say "Show") Radial Menu at the Page Load?! I can Show or Hide the plugin with this codes: ...

How to extract predefined pattern from a string?

Hello all, Given the following string: "<head></head><body>{"filesize":55312,"success":false,"msg":"incorrect-captcha-sol"}<div firebugversion="1.5.4" style="display: none;" id="_firebugConsole"></div></body>" I need to extract the JSON string as follows: {"filesize":55312,"success":false,"msg":"incorrect-captcha-sol"} How should ...

If I have one nav_bar.html file that is included on other pages, how do I show which menu item is active?

Hey everyone... thanks for taking the time to read this. I have a JavaScript (jQuery) navigation bar on my main page that is simply "included" on my page. For example, I have index.shtml that "includes" the nav bar, which is "nav_bar.shtml". And this is the same for every other page. Now clearly, with the current setup, there's no wa...

Execute ActiveX using javascript examples?

Hi, I am trying to create a class that can be access locally through a browser using javascript. I have done some reading and I see ActiveX can do this. I have looks for simple hello world step-by-step examples for how the ActiveX & JS might interact with each other so I could break it down and get my head round it but cant seem to fin...

just some beginner level javascript I thought was cool

I was thinking about design patterns lately, and I had an idea about one I hadnt came across yet (im sure it exists), so I tried to make it, and to my surprise it was easier than I thought. I thought it was cool, so Id like to share it with ya. //pass this object a function, and it adds its //biological and technological distinctivenes...

Why is it taking my function and making it not a function anymore?

I have a function that returns a random number from 1-10. When I use it in my other function it works once, but then it starts having an error that it's not a function. This isn't the exact code, just an example code that's similar. It produces an error saying "TypeError: Property 'ran' of object [object DOMWindow] is not a function" Why...

What is the easiest way to record a list of actions of the browser and replay them over and over?

I want to be able to go a specific webpage like:http://something.com then goto: "javascript:playsong();" then click on a button and after a specific amount of time do it again. If you also know how to make a javascript code be run on a page with a firefox plugiin or something that would help too. THankyou. ...

Is there a way to bypass Javascript / jQuery's same origin policy for local access?

Trying to use ajax, getJSON, and functions like that to fetch an external URL from a local (non-server) development computer. Is there a way to bypass the same origin policy, so that I can test locally, instead of having to upload to a server? ...