javascript

Setting a timer in jQuery/javascript

Hi Everyone, I have a picture slideshow that works on a click of a button like so: ">". The button is a span with id "slideshowRight". Is it possible to set a timer that every 5 seconds literally clicks the slideshowRight button and stops when the mouse hovers over the buttons and restarts when the mouse doesn't hover on them? The hov...

eval-ing a user text. What's the risk ?

I have an html page with a textfield for the user to put expressions like these: (x+23)*2 ((x-y)*(x+y)) x*2/z+y The user enters them and I use the 'eval' method to execute them. Before calling eval I make a check that there is nothing dodgy (like attempting to define a function or similar). It seems to me that I should be fine. But...

jQuery/JS : empty field after success?

at my ajax call success i wish to empty the field. success: function(msg){ $(wrapperId).prepend(msg); } } I tried this: success: function(msg){ $(wrapperId).prepend(msg); $('#message').html(""); } } But it wont work ...

Javascript: Window.Open with a # sign in URL?

I have a local web app that lets users attach and view files. Viewing files is simply window.open(fileName), however whenever the filename has a # sign in it the file will fail to open with a dns error. I've tried escaping the # symbol with %23, and \# but it still fails to open... is there something special I need to do to escape the # ...

Javascript, getting lots of elements and setting them to display none

Hi, i wish to grab a load of elements, check if their id contains 'other' or 'Other' and for those, set the display to none. This is what i have: function Hide(div){ var list; var i; list = document.getElementById(div).getElementsByTagName("input") for(i=0; i<list.length;i++){ if(list[i].id.toString().indexOf("Ot...

JavaScript - AJAX : Accessing an XML File from a Server

Hi, I am trying to access an XML file from a server in my javascript code. I have an XML file like this: -<stream version="1.2"> -<room id="simulator" time="128168557915"> -<dimention id=0 x="1.25" y="2.00"> <m mcu="160" sid="75"> </dimention> </room> -<room id="simulator" time="128168557928"> -<dimention id=0 x="1....

How to fire an event with ExtJS on all HTML elements of a given class

I want to simulate clicking with the mouse on all elements of a given class ("x-grid3-col-value"). I didn't manage to do this with ExtJS as the function "fireEvent" only applies to ExtJS components. How could I do? ...

Javascript - event that reloads the page

Hi all In the example code below I have a button that when clicked reloads the page, but hitting enter does not do so, how would one amend it so that hitting enter would also refresh the page <h3>click to refresh page</h3> <input type="button" value="Refresh" onClick="history.go(0)"> Thank You Ruth ...

Javascript code in asp.net master page dependent on currenty open page.

Hi, I have a problem with my JS script. I have written a function in my Site.Master because I use it in every page of my website. Right now I need to add a new line to that function (execute another function) but, and this is the whole problem, the function to be executed is only defined in one of my content pages. To be honest it does...

How do I encode a URL in JavaScript?

I want to implement a polyvore share button into a shopping cart. Some variable values are not being passed when the script executes (description and price) and I was told that URL encoding could be a solution. Can anyone share any leads on how to apply it in JavaScript alone to my snippet? Thanks in advance. <a href="http://www.polyvor...

Calling PHP script with ajax and jQuery

Right now I have this: echo "<a href='misc/removeWallComment.php?id=" . $displayWall['id'] . "&uID" . $displayWall['uID'] . "&BuID" . $displayWall['BuID'] . "' title='ta bort inlägg'> <span class='removeWallComment'></span> </a>"; Its an icon with a link that removes the comment when you click. Now, it goes to misc/rem...

Append a "no results" message with jQuery

I'm using John Resig's LiveSearch with John Nunemaker Quicksilver score prototype to create a livesearch feature. I'm just trying to figure out how to append a message if no results were found, instead of just having a blank space when there are no results. Any help would be greatly appreciated. ...

jQuery - Find any input with a given class that has no value

Hi All, I have a (very) basic validation script. I basically want to check for any inputs with class .required to see if there values are a) blank or b) 0 and if so, return false on my form submit. This code does not seem to return false: function myValidation(){ if($(".required").val() == "" || $(".required").val() == 0){ $(this)...

Javascript: Get selected radio and paste it on a label tag with jQuery

I have a gender selection radio: <div class="label-inputs" name="userFieldDiv" id="genderUserFieldDiv"> <label class="required">Sexo</label> <input type="radio" class="check" value="F" name="userDto.gender" id="userDto.gender0"> <label for="userDto.gender0">Femenino</label> <input type="radio" class...

allowing any javascript to be injected on my page. What's the risk ?

if my webserver just serves static pages and my html pages allow users to run any javascript. Can a 'bad' user do any damage to me ? p.s. There are lots of talk about watching out about XSS and what I am doing is even worse. I am letting the user to inject his/her javascript. what I don't get is what damage can they do ? Thanks ...

Javascript: get a value with jQuery and replace it.

I have a gender selector, and a script that gets the value of the selected gender and pastes it on a label, but its pasting the value: "M" or "F". <div name="userLabelDiv" id="genderUserLabelDiv"> <label class="required">Sexo</label> <label id="genderLabel">F</label> </div> Now when Im trying to get this letter and replac...

Following a Javascript link using urllib2

I am scraping a website that has a Javascript next link that looks like this <a href="javascript:__doPostBack('DataGrid1$ctl14$ctl02','')">2</a> .The page is written in aspx. Is it possible to call that, to get the information on the next page? Here is the page, http://www.deantechnology.com/hvca/pg_search/fsn.aspx?catalog_sspid=212&am...

Javascript copy down function for radio button

How to copydown to many rows, same information from radio button ? ...

the HTML script tag and non-JS content - Firefox

It appears this code will request the file in Chrome and IE but not in Firefox. <script type="text/my-custom-mime-type" src="test.ashx"> </script> Is there a some spec that says browsers should only process JavaScript related mime-types? I know IE probably supports this because of the history with vbscript. Once you have "content" li...

Dynamically get changed select value JQuery

What I need to do is get the value of the selected option (when changed) in a select list and change the text in a span next to the select list. The problem is I don't know the id the the select list. There are lot of different select list on the page (5-25+) and they are all created dynamically and so I can't have the id specified in th...