This is something of an embarrassing question to ask, seeing as it is mainly about my lack of Javascript knowledge. Seems like it might be "so obvious" that nobody specifies it anymore. Gotta start somewhere! I'm a proficient coder in other languages, I'm just unfamiliar with JS.
On the ReCaptcha Client API docs page, there's an example...
Suppose I have the following HTML code, how can I pass the user's input to execute(str) javascript function as an argument?
<body>
<input name="textbox1" type="text" />
<input name="buttonExecute" onclick="execute(//send the user's input in textbox1 to this function//)" type="button" value="Execute" />
</body>
...
I'm working on a image viewer that has a draggable scrollbar. When the user drags the scrollbar, some of the text on the webpage becomes selected. I've tried
window.getSelection().removeAllRanges();
but that doesn't seem to work in IE7/8. Also tried the
document.getSelection().removeAllRanges();
which seems to work just as "well" w...
Hi!
I am trying to obtain the url from the innerHTML of a web page using javascript.
This is what I'm doing:
var goog = newTabBrowser.contentDocument.getElementsByTagName("pre")[0].innerHTML;
alert(goog.responseData.results[0].url);
BUT it wont work :S
I outputted goog (using alert) and copied that into my program as follows:
v...
hi
i have an asp .net site with a print option (onclick = window.print())
the problem is that when using IE 7 it gets fine on the page
but when users using IE 6 print the page they get it larger than the page is
...
I'm wondering if there's a way to count the words inside a div for example. Say we have a div like so:
<div id="content">
hello how are you?
</div>
Then have the JS function return an integer of 4.
Is this possible? I have done this with form elements but can't seem to do it for non-form ones.
Any ideas?
g
...
Okay, my situation is such: I need to send the contents of a JavaScript array to server where a PHP script will persist individual array entries in a MYSQL database. I am NOT using jQuery but I am about to integrate Prototype framework into my project.
I gather that the JS array can easily be converted to JSON using the toJSON() method ...
I am trying to understand why you would use jQuery.get() and jQuery.get(index). The docs say it is to convert the jQuery selection to the raw DOM object instead of working with the selection as a jQuery object and the methods available to it.
So a quick example:
$("div").get(0).innerHTML;
is the same as:
$("div").html();
Obviousl...
Hi, I have a feature where a user can click a video thumbnail and my php script will go grab the video.
I have a div which is display: none; containing the flash video player code and its background image is the animated gif (a loading spinner) in the css. I use the jquery show method to make it appear when the user clicks it.
But whe...
I am creating my menu with javascript. How possible it is that on page load it is created from the server side (VB ASP.NET) rather than the client side? And if this is possible how is this done? My main aim is that I can create menu items from a database.
Feel free to give your opinion.
...
I need to prompt a user to save their work when they leave a page. I've tried onbeforeunload but I need to show a styled prompt not the usual dialog box. Facebook has managed to achieve this (if you have a Facebook account, edit your profile info and go to another page without saving and you get a styled prompt). I've also tried jquery u...
I am using a tutorial from Imar Spaanjaars' web site to make an entire table row clickable and have a hover effect on it also. Once the user hovers over the table row it removes the pre defined background color for that row. I want to make it so that way it does not overwrite this style. How might I do that?
<script type="text/java...
Can you serialize/deserialize a canvas object in javascript?
...
Hey,
I would like to use an image in firefox extension I am developing. Can someone tell me how to include the image. I used the following but it did not work.
var divTag = content.document.createElement("img");
divTag.id = "div1";
divTag.src="chrome://ff_extension/content/image1.gif";
divTag.setAttribute("align","center");
...
I have gone insane trying to figure out how to make this work. Code looks roughly like:
function onDropDownChanged() {
$("#updatePanel").load(
"myUrl",
{ id: $("#myDropDown option:selected").val() },
onPanelLoaded
);
}
function onPanelLoaded() {
$("#theTextInput").focus();
}
$(document).ready(function() {
$("#myDropD...
I currently am working on a little app that requests user info from my server and displays them using a special template.
At first, I just hardcoded the little snippet in jQuery:
$("<li><div class='outer'><table><tr><td rowspan=2 class='imgcontainer'><img class='thumb'/></td><td><span class='username'/></td></tr><tr><td><span class='n...
Hi,
I am making a ajax call, and the backend is gonig to return a JSON array.
Can someone give me an example of what my json array should look like so I can do the following in javascript?
if(myJSON.ErrorCode == 100)
{
alert(myJSON.Response.Message);
for(var x = 0; x < myJSON.Response.Values.Count; x++)
a...
Is there any JavaScript function that can unify $ function from both Prototype and jQuery?
Yes, this is the real use case I am facing now. I find $ function in Prototype and $ in jQuery is conflicting each other. I know that we could us jQuery.noConflict() to ressign $ back to Prototype, however by doing so, I will have to rewrite jqu...
Is there a way to manipulate the clipboard data in JavaScript?
Also is there a way to implement the visual studio ***
Ctrl+Shift+V
option to paste clipboard data in cycle?
...
Hi there, I have a question.
Firstly, I am not going to pretend that I know what I am talking about here. I am a newbie to http and JavaScript.
I think my question may be answered in this post
http://stackoverflow.com/questions/116967/img-src-tags-and-javascript
but I thought I would explain the exact thing I am trying to achieve in ca...