javascript

Problem after adding <form>?

When i added <form> to my web page, all my javascript stopped working, and when i put the form at the begining of my table submit wont work, what i am doing wrong. below is my code after testing on other browser it works fine but on Firefox it doesn't Update: After checking on firefox java error console it appears that Checking Function...

Get text (not url) from address bar in Google Chrome

I want to retrieve the text that the user has typed into the currently visible address bar, using Javascript. This is for google chrome only. Is this possible? I know you can get the document URL via window.location.href, but I am unable to locate any javascript pertaining to current code inside the address bar/omnibar. Thank you for t...

javascript and jsp

I am new to Java. I have a HTML which has a show users button, on clicking this button I want to redirect the user to the users.jsp page. How do I achieve that? Will a function like this help? function msg() { alert("List of Users");<br/> jsp:forward page="Users.jsp"<br/> } ...

How to combine mvc2 client side validation with other client side validation?

I have a page using mvc2 with client side validation. The client side validation is provided by Microsoft Ajax mvc validation script. This does very well to validate all fields that are related to the model. I also have fields that are never sent to the server such as the confirm password value, and the accept agreement. For these fie...

Is there javascript to convert HTML to markdown?

There is showdown.js to convert markdown to HTML, and PHP Markdown to convert markdown to and from HTML. My question is, is there javascript library to convert HTML to markdown? ...

Making all links inside of a div call the same function?

I'm trying to make a notification area that will show alerts. return this.each(function() { jQuery('<div class="' + o['className'] + '">' + o.msg + ' + '<a href="#" onclick="$(this).parent().remove(); dismiss(' + o["id"] + ');">X</a>' + '</div>') .appendTo(this); }); This just takes a message pulled from the database, a...

How do I select dynamic ids in this format?

I'm trying to select dynamic ids when a user types something into the input fields. My app spits out the input fields in the following format: <input id="student_1_first_name" /> <input id="student_1_last_name" /> <input id="student_2_first_name" /> <input id="student_2_last_name" /> <input id="student_3_first_name" /> <input id="stud...

Script tag in XHTML

Hi, This might sound like a reaaaally dumb question but... why do browsers have a fit with this syntax: <script type='text/javascript' src="/path/to/my.js" /> and want this instead <script type='text/javascript' src="/path/to/my.js"></script> Seems the first construct should be valid since there's no inner content to the tag.. ?...

Is there an open source javascript rich text editor similar to gmail's?

I've looked at free javascript html editors, and I haven't found any that I feel handle links intuitively. I like the way the gmail editor does it (also the same way blogger.com) does it. Does anyone know if there is an open source editor that handles linking that way? Jquery would be preferable. ...

safely encode and pass a string from a html link to PHP program

What series of steps would be reqired to safely encode and pass a string from a html href using javascript to construct the link to a php program. in javascript set up URL // encodes a URI component. path = "mypgm.php?from=" + encodeURIComponent(myvar) ; in php: // get passed variables $myvar = isset($_GET['myvar']) ? ($_GET['myva...

Easiest way to pass a javascript array or its values to a servlet using jQuery's ajax() function

I have a Javascript array. I want to pass it's data to a servlet using the ajax() method of jQuery. What is the easiest way to do this. The index values i.e. the i in array[i] are not in order, they are numbers that have meaning themselves, hence I cannot simply loop through and create a GET queryString, or so I believe. Maybe I should...

How to change font color inside an existing script?

Hi everyone, I get a script from a website to put it into my website, but the font color is not what I want. The script is: <script language="javascript" src="http://www.parstools.net/calendar/?type=2"&gt;&lt;/script&gt; and now I want to change the font color of it. What should I do? I would really appreciate your help, thanks. ...

How do I check if a (javascript) array value is empty or null

Will this work for testing whether a value at position "index" exists or not, or is there a better way: if(arrayName[index]==""){ // do stuff } ...

how to disable a javascipt hyperlink?

Hi everyone, I just get a script from a website to put it on my own, but it has a hyperlink on it and I want to disable that, here is the script: <script language="javascript" src="http://www.parstools.net/calendar/?type=2"&gt; </script> thanks. ...

Why can't I call this function (javascript/jquery)

This is driving me nuts .... I have written a function function seraliseQuery(){ for(var i=1; i<=variables;i++){ alert(queryPreds[i]+" - "+queryObjs[i]); } } I just want to be able to call it from my other function $(".object").click( function() { // code removed seraliseQuery(); }); The error I get is "the function seri...

iFrame isolation

Just a thought, but would using an IFRAME over a DIV essentially make that element isolated from the window in a way that slow scripts running in the IFRAME wouldn't affect the other frames/window? ...

how to create pagination like stackoverflow

hello all how to create pagination like stackoverflow? ...

How to change the JSON output format and how to support chinese character?

Currently I using the following code to get my JSON output from MySQL. <?php $session = mysql_connect('localhost','name','pass'); mysql_select_db('dbname', $session); $result= mysql_query('SELECT message FROM posts', $session); $somethings = array(); while ($row = mysql_fetch_assoc($result)) { $somethings[] = $row;...

How to encode a URL for passing it as a GET parameter

I load a JavaScript file which takes current page's URL as a parameter. Here is the code I use: document.write(unescape('%3Cscript src=\"' + _vis_opt_protocol + 'domain.com/js.php&a='+account_id+'&url='+encodeURIComponent(document.URL)+'&random='+Math.random()+'\" type=\"text/javascript\"%3E%3C/script%3E')); I thought encodeURICompone...

How to show error message with jquery tooltip?

I am validating my controls in a form... if a control is empty i would like to show a jquery tooltip with that error msg.. Here is what i am doing... if (document.getElementById("ctl00_ContentPlaceHolder1_ListDiscipline") .selectedIndex == -1) { document.getElementById("ctl00_ContentPlaceHolder1_ErrorMsg").innerHTML = "ple...