javascript

Unterminated string constant

My Description contains an apstrophe('). How to escape it. <a href='javascript:select("<%= pageBean.replace(list.getColumn(0), "'", "'") %>", "<%= pageBean.replace(list.getColumn(1), "'", "'") %>");' title="<%=selRpt%>"> <span class='img-view'></span></a> "<%= pageBean.replace(list.getColumn(1), "'", "'") %>" is the description part i...

Javascript: How to extract multiple numbers from a string

Input: "NEW YORK (Reuters) U.S. stock index futures pointed to a slight rebound on Wall Street on Wednesday, with futures for the S&P 500 up 0.34 percent, Dow Jones futures up 0.12 percent and Nasdaq 100 futures up 0.51 percent at 0921 GMT." Output should be array of all numbers including floats. A little similar thread but it ex...

Encryption: simulate SSL in javascript and python

Because of china Great Firewall has blocked google appengine's https port. So I want to simulate a Secure Socket Layer by javascript and python to protect my users information will not be capture by those ISP and GFW. My plan: Shake hands: Browser request server, server generate a encrypt key k1, and decrypt key k2, send k1 to brow...

Problem rendering vanilla JavaScript in Ruby

Hi all, In My controller I am trying to render vanilla JavaScript but am getting an unexpected result. This is the code class UploadController < ApplicationController def index render :file => 'app\views\upload\uploadfile.rhtml' end def uploadFile render :js => "alert('Hello Rails');" post = Da...

JavaScript search() fails to find "()"

This might seem trivial, but I'm new to JS. I have this piece of code: alert(elementAction); var argumentsBegin = elementAction.search("("); var argumentsEnd = elementAction.search(")"); alert(argumentsBegin); elementAction is a string. The problem with the code is it doesn't seem to find the parenthesis. The first alert box shows...

mozilla's term "Global Objects" confused me

Several friends suggest me to read developer.mozilla.org/en/JavaScript/Reference/Global_Objects: The term "global objects"[1] here is not to be confused with the global object[2]. Here, global objects[3] refer to objects in the global scope. The global object[4] itself can be accessed by this in the global scope. In fact, the global sco...

...

    Using Javascript /jquery displaying a single file in a fly out

    Hi! I am trying to add a player that will play audio on the site. It will play music randomly and display only play/pause? are there any good javascript or jquery plugin/api? What is the best way to display a single music filefrom a list of files on a flyout on hover? it will have the option to display filename and download option. A...

    Javascript nodeValue returns null

    Title should make my problem well described.Here goes my code. <div id="adiv"><text>Some text</text></div> <script type="text/javascript"> function vb(){ alert(document.getElementById("adiv").firstChild.nodeValue); //returns null } </script> <input type="button" onclick="vb();" value="get"/> wheres the problem..? ...

    How to know if .keyup() is a character key (jQuery)

    How to know if .keyup() is a character key (jQuery) $("input").keyup(function() { if (key is a character) { //such as a b A b c 5 3 2 $ # ^ ! ^ * # ...etc not enter key or shift or Esc or space ...etc /* Do stuff */ } }); ...

    Getting the last item in a $('div').each()

    I am using jquery and the each function but I am having trouble finding the last item in a ul list. DATA: <ul id="1"> <li>1</li> <li>2</li> <li>3</li> </ul> <ul id="2"> <li>1</li> <li>2</li> <li>3</li> </ul> <ul id="3"> <li>1</li> <li>2</li> <li>3</li> </ul> I have tried multiple things bu...

    Reset HiddenField if AutoCompleteExtender returns no results

    Hi i need to be able to reset a HiddenField's value if my AutoCompleteExtender returns no results (specifically, if the user searches for something that's not in the list/database). I have this JS code now: function autoCompleteItemSelected(source, eventArgs) { var assocHiddenField = document.getElementById(source.get_id() + '_hidde...

    How to make static Dynamic pages ?

    In MyBB forums you must have seen that all those threads are stoed as forum.com/Thread-Name-of-the-thread So now this is static right ? So now i have a site which has blog.com/search.php?=SEARCHED+TEXT So now how do i save this search so that Google can find out this page on my site ? Indirectly what i mean to say is how i can i make...

    back button query

    IE & Chrome issue When i simple click on one field and backit it is properly working but when i filter that field by name or any other than message is display web page expires on clicking on back button ...

    How to convert keycode to character using javascript

    How to convert keycode to character using javascript var key_code = 65; result should be character = "a"; ...

    Relationship between the textbox and image

    Hey, Easy question for ASP.NET profenssionals: I have a few dynamic generated textboxes in a row. In this row is also a image with an eventhandler "onclick". I will create a relationship between the textbox and the image. I click on the image, choose a value and then the textbox will be filled. Currently my controls have following dynam...

    disable a sellect input based on another select input in jsp page using javascript

    i have two select input fields in a jsp page. i want to disable the second input based on the value of first input. i wrote the function. but it is not working, plz help. function selectTimePeriod() { var rtype = document.getElementById('customer.customerType').value; var corporateSize = document.getElementById("customer.corporateSize"...

    is there any function like string.isnullorempty() in javascript

    I always (thing != undefined || thing != null)?...:...; check. Is there any method will return bool after this check in javascript or jquery ? And how would you add this check in jquery as a function? ...

    Asp.net MVC Razor - Custom javascript inside if block

    How can I put javascript code inside if block. @{ #if DEBUG $("#User").val("JDoe"); $("#Password").val("secrect"); #endif } When I try above code I get this compiler error: Compiler Error Message: CS1056: Unexpected character '$' And if I change $ to jQuery: Compiler Error Message: CS0103: The name 'jQuery' does no...

    Should I learn Python?

    Hi, I am a Javascript developer. I don't know anything about Python except that it is an Object Oriented interpreted language. So please suggest me that if I should learn Python? what it is exactly for? is it a replacement or closely related to javascript? And what is the future of python? etc. Thanks ...