JQuery :: Different Results Depending On How Many Bookmarks Deleted
May 27, 2009
I have the following Javascript code and I can't seem to get it to work properly...
function DeleteSelectedBookmarks() {
bookmarksToBeDeleted = array();
if (document.deletebookmark.elements.length == 1) {
if (document.deletebookmark.deletebookmark.checked) array_push(bookmarksToBeDeleted, document.deletebookmark.deletebookmark.value);
} else {
checkboxes = document.deletebookmark.deletebookmark;
for (i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].checked) array_push(bookmarksToBeDeleted, checkboxes[i].value);
}} if (count(bookmarksToBeDeleted) == 0) {
alert("You haven't selected any bookmarks to delete.");
return;
}
$.get("bookmarks.php", {delete: serialize(bookmarksToBeDeleted)},
function (result, bookmarksToBeDeleted) {
if (result == "done") {
if (count(bookmarksToBeDeleted) == 1) alert("Bookmark Deleted.");
else alert("Bookmarks Deleted.");
} RefreshBookmarks();
});}
What it is supposes to do is gather the amount of bookmarks that need to be deleted and then send the command to the server to do so. The server then gives a message back (if it is successfully the result is "done") and depending upon how many bookmarks it deleted it gives a different result, ie. singular vs. plural. How do I do this?
View 1 Replies
ADVERTISEMENT
Oct 8, 2011
I have been on this for over an hours now, it is probably something simple and/or stupid, but why doesn't this script work? I have read forums til my eyes are crossed and can't see what I am doing wrong I am new to javascript, but not programming. The point here is to create a function that compares two strings and then shows or hides a div depending on the results of the comparison. I was trying to pass in the name of the two input text boxes containing the text and the name of the div to show or hide (so that it can be used in multiple scenariios.) Right now my error message is that document.getElementById(field1).value is not a function.
Here is the code below..
View 6 Replies
View Related
Oct 12, 2006
I think it's impossible to know if visitor has bookmarked your website, but if someone has any ideas how to check this,
View 5 Replies
View Related
Jun 6, 2011
i'm trying to make a little script that automatically adds bookmarks to google bookmarks from a html file;
this is what i currently have:
javascript:
var googleBookmarks=document.createElement("div");
googleBookmarks.id="googleBookmarks";
googleBookmarks.innerHTML="<h1>Google Bookmark</h1>";
for(i=0;i<document.links.length;i++)
[Code]...
View 4 Replies
View Related
Jul 28, 2009
Not sure whether this is a bug, but is is certainly unexpected behaviour. When i try to use replaceWith on a <div /> instead of a <div></div> (which is correct HTML syntax) it causes, not only the div but all code after the div to be replaced. see the code here: [URL] I will make a bug report if others also think this is a bug.
View 2 Replies
View Related
Dec 22, 2005
I am trying to update a <p> tag using the .innerHTML property. The <p> tag is set-up as
<p id="p_id">
<form id="form_id">
<![CDATA[Other form stuff here]]>
</form>
</p>
And my JavaScript
document.getElementById('p_id').innerHTML = 'my message here.'
alert(document.getElementById('p_id').innerHTML);
When I call that JS code, it adds "my message here" in front of the form and only alerts "my message here", not the form code.
When I add text by default in front of the form code, that gets replaced but the form still remains.
View 4 Replies
View Related
Jan 3, 2011
Aside from using code to delete a JavaScript session cookie, what can arbitrarily overwrite/delete a JavaScript session cookie?
I ask because I have something that is working flawlessly in development; but as soon as it's moved into a staging area for testing, it stops working.
My initial thought was that there is something causing the browser to think that it's being redirected to another domain, thereby deleting the session. But further testing indicates this is not the case.
Basically put, I have a detail page for clients that contains nine categories; all categories are loaded in an "expanded" state (shows all information for each category) and has a "hide" link next to the header. Click "hide" and the whole category collapses, and the link becomes "expand"; click "expand" and vice-a-versa.
Also on initial page load, the document looks for a session cookie called "vddstatus"; if it does not exist, it creates the session cookie with default values set so that all categories are expanded; if it does exist, it checks the values and adjusts the expanded/hidden status as needed. This way, no matter what page you go to, when you come back to the details page, it remembers the expanded/hidden status of each category.
Like I said, on the development server it works excellently; in the staging environment, the only time it remembers the category statuses is if you click "HIDE ALL"; anything else it apparently deletes the session cookie and generates a new one, set to all categories expanded.
View 14 Replies
View Related
Oct 26, 2010
This code is supposed to create a new row so i can add more data to it, but the thing is that when i hit the enter key to create a new field it will delete the information i just entered.[code]For now, just ignore the fact that the submit button is disabled, that one should be enabled once i had validated every entry against a database using ajax.
View 3 Replies
View Related
Jan 17, 2011
I am doing task for deleting cookies in javascript for IE and Mozilla. for that i written function is
Quote:
function deleteCookie(name, path, domain) {
if (getCookies(name)) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
[Code]....
Now , How i know whether my cookies get deleted or not.I am not sure whether my browser cookies are deleted or not
Is there any test is there from where i can confirm the same.
View 3 Replies
View Related
Nov 3, 2011
I have an Extjs web app that's running on a spring/rest backend & I'm having a really strange caching issue with my web app's javascript files & no-one seems to be able to tell what it is.The issue is that I have deleted a section of code in the JS file, yet it's still appearing in the browser, both IE and FF.
Manually remove & re-add the file
Rollback the file to a previous version
Remove the file from the index.html and re-add it
Clear all cache in FF & IE
Disable firebug
Check the script is updated by manually accessing the file via the application URL & Firebug Script tab
Renaming the JS file
Renaming the index.html file
I'm at a loss as to what could be causing it.
View 1 Replies
View Related
May 19, 2009
I am using a javascript code to refresh a page.
<code>
window.location.href="";
</code>
this code refereshes the whole page and focus goes at the top of the page but I want the focus of the page at the same place where I perform refresh. Actually I am using AJAX to submit a form, a form opens through ajax request but I need to refresh the page to take the effect of the dynamic data, which is being saved,updated or deleted on the page. So is there any way where focus of the page remains there when I refreshed the page
View 9 Replies
View Related
Jun 6, 2009
i want to ask that is it possible that using javascript injection the contents of a web page can be altered (add / edit / deleted) in Line of Code.Since, this has happened with me couple of times,talking to the support team at my hosting provider, they say that its due to the security holes in the Coding, but i think that its the security issue at the hosting side (since modifying the web pages code)i've found this code immediately after the opening of the body tagearlier the page snoofing for the above URL was working, but now its not producing the output. (so can not post whats inside it).My Another website (hosted by the same provider) is also infected. there the code immediately after the body tag is again the page snoofing yeilds no output with the error
View 6 Replies
View Related
Apr 30, 2010
i want to make an animation where one value depends on the other.
Let's say i want to animate both the 'top' and 'marginTop' properties, where i want the marginTop property to use the current value of the 'top' property.
I could do something like this:
$("#foo").animate({
top : "100px",
marginTop : ($("#foo").css('top') * 2) + 'px'
});
But that doesn't work, i guess because the css('top') method only gets called after the animation has finished.
Is there a trick to get the value of 'top' in the 'marginTop' property?
View 2 Replies
View Related
Sep 1, 2011
I'm now working on kind of invoice form which in it the user can add as much input field as he wants.
The problem is that after adding a new input field - the content in the other fields is deleted.
Code:
View 8 Replies
View Related
May 27, 2011
$("#ltr").live("mouseover", function() {
//swap class names
$("div#container").removeClass("rtl").addClass("ltr");
});
I run this function to swap class names when there is a mouseover event on an image with the ID "ltr". How would I run this same function but to occur when, for example, a variable "distance" was equal to 0? Basically, if distance = 0 then swap class names
View 2 Replies
View Related
Jan 10, 2010
I want to add a button, beside the "Add" and "Remove" button which pick random of users depending on a given value, lets say that the value is 2, then it would pick 2 users randomly and move them to box 2.
Code JavaScript:
$().ready(function() {
$('#add').click(function() {
return !$('#box1 option:selected').remove().appendTo('#box2');
[code]...
View 24 Replies
View Related
Oct 20, 2010
I'm fairly new to jquery and slowly picking it up as I go. Here is a problem I though would be simple-ish but I am stuck. I think I have most of what I need, I just need the correct way of writing 1 part of it.
[Code]...
View 4 Replies
View Related
Mar 25, 2011
I have a single page which uses tabs to segment the content. Alongside the tabs themselves is a button for 'Help'. I'd like this button to open a different DIV depending upon the tab that is currently being used.For example, if I am on a tab for 'Ben', if I click the 'Help' button I want the 'helpBen' DIV to slideToggle.If I am on a tab for 'Paul', when I click the 'Help' button I want it to open the 'helpPaul' div.
Some extra needs:
1. switching to a different tab should close the currently open help div (e.g. helpBen or helpPaul)
2. There should only be one help div (e.g. helpBen or helpPaul) open at any one time.
I partly solved this with the following code but with erratic results and I'd like to know what I'm dong so wrong!Here is the HTML for the help button:
<a class="helpTrigger" href="#">Help</a>
The help DIV's are like this:
<div class="helpBen">help relevant to Ben section</div>
<div class="helpPaul">help relevant to Paul section</div>
The CSS for .help is display: none; by default so none are shown from the outset.
And here is the jQuery
$(".helpTrigger").click(function(){
if (location.hash == '#Ben') {[code].....
In the words of Dr Evil, "throw me a frikkin' bone here..."
View 6 Replies
View Related
Oct 16, 2010
If I have an 'dynamic' Div that sometimes contains the word Red or sometimes contains the word Green, i would like to replace (or something) the ID to something else.If the word inside the div is Green I need to use a green background, but if the word is red in the div, i need to have it in a red background.
<div id="x">Green</div>
<style>
#y {
background-color:Red;
[code]....
View 2 Replies
View Related
Aug 12, 2011
I was wondering if there is a way to use Jquery to reduce the amount of images I use on my company website as well as resize them depending on the page they're displayed on. It's just that I feel that's it's very tedious creating 5 or 6 formats for each campaign each with it's own dimensions depending on the page and unfortunately my company doesn't want to implement a Backoffice fed site, which means I have to do it all manually.
View 3 Replies
View Related
Sep 7, 2010
I've been going round in circles on this big time, getting very annoyed, and can't seem to find an answer anywhere. This little bit of jQuery collapses our menu, so that when we roll over, the sub menus float out:
<script type="text/javascript">
function initMenu() {
$('#SideCategoryList ul ul').hide();
$('#SideCategoryList li a').hover(
function() {
$(this).next().slideToggle('slow');
}
);
[Code]....
View 8 Replies
View Related
Dec 17, 2009
I have encoded same javascript file with "Microsoft script encode" and accidentally deleted the original file.There is a way to convert the encoded file into the original version.. The form of the encoded file is : <script type="text/jscript.encode">#@~^.....
View 5 Replies
View Related
Apr 22, 2009
I have a list that looks like this:
<ul id="thisList">
<li class="this0">content</li>
<li class="this1">content</li>
<li class="this1">content</li>
[Code].....
View 4 Replies
View Related
Oct 14, 2010
How to change style on a series of divs (with similar structure but different content) *only if* all the children are visible (that's using visibility, not display).
Sample div:
<div class="h">
<p class="a1">text</p>
<p class="b2">more text></p>
<p class="b3">text text</p>
<p class="a4">text...</p>
<p class="link_display_none_visibility_visible">div name</p></div>
I think it needs to use contents(), but not sure about handling node numbers.
View 5 Replies
View Related
Jun 18, 2010
First, my url looks like this [url]...
I would like, depending on the value of the anchor called, to add a class to the box related.[code]...
View 14 Replies
View Related
Jun 28, 2009
What I'm trying to do is create three rules depending on the path of a page. If the path contains 'best-sellers', I want jQuery to set the class of the page to 'pm-best-sellers'. I can do this, and it works, but when I add the rules for 'express-gifts' and 'eco-friendly' it breaks.
Here's what I've got:
View 8 Replies
View Related