I am developing some JavaScript that should work with either Prototype.js or JQuery, thus I need some way to identify what is the primary library in use. How can I do that?
I'm working with an existing JavaScript-powered cart module that I am trying to modify. I do not know JS and for various reasons need to work with what is already in place.
The text that appears for my quantity box is defined within an existing function:
function writeitems() {
var i;
for (i=0; i<items.length; i++) {
var item=items[i];
var placeholder=document.getElementById("itembuttons" + i);
var s="<p>";
// options, if any
if (item.options) {
s=s+"<select id='options"+i+"'>";
var j;
for (j=0; j<item.options.length; j++) {
s=s+"<option value='"+item.options[j].name+"'>"+item.options[j].name+"</option>";
}
s=s+"</select> ";
}
// add to cart
s=s+method+"Quantity: <input id='quantity"+i+"' value='1' size='3'/> ";
s=s+"<input type='submit' value='Add to Cart' onclick='addtocart("+i+"); return false;'/></p>";
}
placeholder.innerHTML=s;
}
refreshcart(false);
}
I have two different types of quantity input boxes; one (donations) needs to be prefaced with a dollar sign, and one (items) should be blank.
I've taken the existing additem function, copied it, and renamed it so that there are two identical functions, one for items and one for donations. The additem function is below:
function additem(name,cost,quantityincrement) {
if (!quantityincrement) quantityincrement=1;
var index=items.length;
items[index]=new Object;
items[index].name=name;
items[index].cost=cost;
items[index].quantityincrement=quantityincrement;
document.write("<span id='itembuttons" + index + "'></span>");
return index;
}
Is there a way to declare a global variable based on which function (additem or adddonation) is called so that I can add that into the writeitems function so display or hide the dollar sign as needed? Or is there a better solution?
I can't use HTML in the body of the cart page because of the way it is currently coded, so I'm depending on the JS to take care of it.
Any help for a newbie is welcome. Thanks!
I have a three column Table View populated by two NSMutableDictionaries which share the same keys (ie key | value1 | value2 ) with dict1(key,value1) and dict2(key,value2).
I want to manually enter data in the third column and create the key/value objects in dict2. But when I do that, my code picks the wrong key :S
Here's the code for the delegate :
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
if ([[aTableColumn identifier] isEqualToString:@"value2"])
{
[dict2 setValue:anObject forKey:[[[aTableView tableColumnWithIdentifier:@"key"] dataCellForRow:rowIndex] stringValue ]];
}
}
Any idea ?
hi guys.
How do I disable the save password prompt in web browsers whenever I'm submitting a form. I've seen a few bank sites where this doesn't come up.
Are they doing it through JS or there any http headers or HTML meta tags available to achieve this?
I'm trying to do this for a mobile application. Please pour your ideas.
http://plugins.jquery.com/project/semantictabs
What is the means of this
Status - Recommended for 1.0.x
I'm using this plugin code as it is http://plugins.jquery.com/files/jquery.semantictabs.js_4.txt
then this ( I'm also using prototype.js onsite)
jQuery.noConflict();
jQuery(document).ready(function(){
$("#mytabset").semantictabs({
panel:'.mypanelclass', //-- Selector of individual panel body
head:'headelement', //-- Selector of element containing panel header, i.e. h3
active:':first' //-- Which panel to activate by default
});
});
I'm creating a script with javascript which works in every browser except IE.
<script type="text/javascript">
(function() {
var sc = document.createElement('script');
sc.type = 'text/javascript';
sc.src = 'http://domain.com/script.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(sc);
})();
</script>
How could I get this working in IE (tested IE6, IE7, IE8)?
I need Regex which can satisfy all my three condtions for zip-code. E.g-
12345
12345-6789
12345 1234
Any pointers and suggestion would be much appreciated. Thanks !
Hi,
In Rails is there a way to get the URL to the image (going through the assets_host) and just return the URL of the image? I want to use assets_host data in my Javascript, but I just need to insert the URL into the JS, not the whole image_tag.
Thank you in advance!
Hi, for some odd reason the text area I have in my site won't accept the width I tell it to, I've tried to select it three times in the CSS just to make sure!
Here is a jsfiddle example that shows what I want, and here is the page where it doesn't want to work. I have searched through the CSS to find any conflicting textarea properties, but there are none.
Thanks for the help!
Hi all,
I have to make some charts on a "mobile" website, what is the best framework to do this?
I see Google Charts API, JQuery Visualize, Raphael and JS Charts... but i don't know who is the best one in Safari Mobile.
Thanks in advance to your response.
If one has a number of databases (due to separate application front-ends) that provide a complete picture - for example a CRM, accounting, and product database - what methods are available to centralize/abstract this data for easy reporting?
Essentially, I'm wondering if there is a way to automatically pull data from multiple databases into a central repository that is continuously updated from the three databases and which can be used for reporting?
I'm also open to alternative best practice suggestions?
Hi everybody,
I was thinking about the possibility of accessing all the variables that are passed into an function, and merge them into an array. (Without passing variables into an array from the beginning)
Pseudo-code:
// Call function
newFunction('one', 'two', 'three' ) ;// All values are interpreted as a one rray in some way
// Function layout
newFunction( ) {
// $functionvariables = array( All passed variables)
foreach ($functionvariable as $k => $v) {
// Do stuff
}
}
hi this plugin to highlight words but I'm trying to highlight diacritic arabic word like this example :
jsfiddle.net/z8PUG/84/
but its not working i tested for three arabic characters
'?': '[\u0645\u064b\20\u0645\u064c\20\u0645\u064d\20\u0645\u064e\20\u0645\u064f\20\u0645\u0650\20\u0645\u0651\20\u0645\u0652\20\u0645\u0653]',
'?': '[\u062d\u064b\20\u062d\u064c\20\u062d\u064d\20\u062d\u064e\20\u062d\u064f\20\u062d\u0650\20\u062d\u0651\20\u062d\u0652\20\u062d\u0653]',
'?': '[\u062f\u064b\20\u062f\u064c\20\u062f\u064d\20\u062f\u064e\20\u062f\u064f\20\u062f\u0650\20\u062f\u0651\20\u062f\u0652\20\u062f\u0653]',
I have a flash app (SWF) running Flash 8 embedded in an HTML page. How do I get flash to reload the parent HTML page it is embedded in? I've tried using ExternalInterface to call a JS function to reload the page but that doesn't seem to work...
I have my matrix I have created, a pic found here.
http://s816.photobucket.com/albums/zz83/gavakie/?action=view¤t=matrix.jpg
The first three column what whats being grouped by but I can had the names of those columns, how can I do that in Reporting Services?
Hello
While trying to understand how a web server worked, I came accross this:
//myfile.js
function donothing(){};
//myfile.html
javascript:donothing(open('http://www.acme.com/whatever.jpg','','left=100, right=0, top=100, scrollbars=no, status=no, titlebar=no, resizable=no, toolbar=no, menubar=no, width=255, height=255'))
I'm no JavaScript expert, so I don't get how an empty function can be made to work. Does someone know?
Thank you.
I'd like to measure to distinct user experience points during the rendering of an HTML page:
1) Point which user sees the first painting of the page
2) Point at which user can interact with the page - meaning sees 75% of it or can actually register a button click or link click
I am pretty certain these UX interactions can start before the HTML code is fully rendered, so would that instance be the JS func "OnLoad" or some other distinct measureable value/function?
If it helps, we can even narrow the answer down to webkit based browsers.
I have 3 options to increment value of an integer by 1 in a C# application
i++
i+=1
i=i+1
The result of all three operations would be same but I would like to know which one would be the best to use if I need to use this statement in an application where the performance is critical.
As no one can help me with my UJS ajax problem I am trying "respond_with", but I am getting this error:
RuntimeError (In order to use respond_with, first you need to declare the formats your controller responds to in the class level)
Yet I have declared it in my controller:
class HomepagesController < ApplicationController
respond_to :html, :xml, :js
def index
@homepages = Homepage.search(params[:search])
respond_with(@homepages)
end
Anyone has any ideas why.
I have the following questions concerning the differences between the four options:
What is the main difference between the four options?
Which of the above support int64_t or long long without suffix LL. I want a data type of the range 2^63 - 1
If your answer to my second question is not C(gcc 4.3.2) , whether the code I write in C(gcc 4.3.2) for C language will be valid in rest of the three options or do I have to modify something, then what will be those modifications.
I have some hover() JS code:
$( '.leftMenuProductWrapper').hover (
function () {
},
function () {
});
In the second function, I need something like:
If ($("#leftMenuWrapper2").hasMouseover){
do this
}else{
do that};
I can't find any documentation on how to do it.
Hello,
I am in dire need of a such regular expression where my alphabet is made up of 0s and 1s.
Now I need a language that accepts all words as long as it has three 0s.
IE:
000
10001
0001
1000
10000101
Is there a way to get the timezone of the connecting user using Pylons, and to adjust the content before rendering accordingly? Or can this only be done by JS?
Thanks.
In Haskell, there is a function "take n list" which returns the first n elements from a list. For example "sum (take 3 xs)" sums up the first three elements in the list xs. Does F# have an equivalent? I expected it to be one of the List-functions, but I can't spot anything that seems to match.
This overlay seems to be the only overlay plugin that works within my schools wonky template... but the problem is that when the browser is resized the shadowbox resizes too, clipping the contents inside. I want it so the box stats fixed and if the browser does get smaller the browser will have scrollbars.
I know it's been modified before, but i dont know where to start. I cant even find an unminified version of the .js file.
Thanks