if (pathname == "/" || pathname == "/default.asp")
in js using jquery library.
I want this to catch "Default.asp" as well as "DeFaULT.asp" and "default.asp"
halp.
Hi, I have a Firefox 3.6.2 problem (3.5.x works just fine).
This is the code:
...
var newImage = new Image();
newImage.onload=function() {swapMapImg(newImage);};
newImage.src = newBackground;
...
function swapMapImg(newImage) {
alert('bingo');
}
Firefox 3.6.2 no longer fires off my onload event, any ideas?
I'm writing a script to take an array of strings, split them by characters, and print them out to the screen. This is what I have and for some reason it is not doing anything. Any ideas?
function autowrite() {
var write_text=["Your Memories","Your Thoughts","Your Photos"];
var split_text = Array();
var i;
var c;
for(i=0; i < write_text.length; i++)
{
split_text[i] = write_text[i].split("");
for(c=0; i < split_text.length[i]; i++)
{
alert(split_text[i][c]);
}
}
}
I have created one simple note taking application in jquery & php.
Current functionality is like when user clicks save button it sends a ajax request with complete data to update it in db(mysql).
All works well. But now I want to auto save only changed text while user typing.
I don't want to send entire text to server again and again in text change event.
It should send only text which has changed.
For Ex:
This is saved text.
When user continues typing.
This is saved text. Unsaved text..
It should be able to send only "Unsaved text.." to server to update in db.
How can i implement this in jquery & server side script.?
Any Idea..?
i am using Jvectormap to place 2 maps on my page.
the maps are placed normally and everything is fine. they are placed in 2 different divs:
<div id="map1">
</div>
<div id="map2">
</div>
and the Jquery:
$(function () {
$('#map1').vectorMap({
color: '#aaaaaa',
backgroundColor: '#ffffff',
hoverOpacity: 1,
hoverColor: true
});
});
$(function () {
$('#map2').vectorMap({
color: '#aaaaaa',
backgroundColor: '#ffffff',
hoverOpacity: 1,
});
});
Now when I try to change the colors of map2 dynamically using:
$("#map2").vectorMap("set", "colors", colorsDictionnary);
The colors of the first one only is changed.
and this happens only when changing colors. Always the first one have it's colors changed even if I am using $("#map2")
How can change the colors of the map2 without touching map1?
Thank you very much for any help, I really need it
been having trouble with this script, ive managed to get it working in ie8, works on chrome fine.
initilize: function(){
$('#my_form').submit(function(){
if ($.browser.msie && window.XDomainRequest) {
var data = $('#my_form').serialize();
xdr=new XDomainRequest();
function after_xhr_load()
{
response = $.parseJSON(xdr.responseText);
if(response.number =="incorrect format"){
$('#errors').html('error');
}
else
{
$('#errors').html('worked');
}
}
xdr.onload = after_xhr_load;
xdr.open("POST",$('#my_form').attr('action')+".json");
xdr.send(data);
} else {
$.ajax({
type: "POST",
url: $('#my_form').attr('action')+".json",
data: $('#my_form').serialize(),
dataType: "json",
complete: function(data) {
if(data.statusText =="OK"){
$('#errors').html('error');
}
if(data.statusText =="Created"){
response = $.parseJSON(data.responseText);
$('#errors').html('Here is your code:' +response.code);
}
}
});
}
return false;
});
}
I understand that ie7 does not have the XDomainRequest() object. How can I replicate this in ie7.
Thanks, in advance
I am working with jQuery Pagination, and a popup form. On saving the data in the form, how would I go about forcing the Pagination plugin to reload the data it would load for whatever page I am on, without reloading the entire webpage?
Ex:
Item 1
Item 2
Item 3
Add Item-Item 23-Save-Reload List
Item 1
Item 2
Item 3
Item 23
http://d-scribe.de/webtools/jquery-pagination/lib/jquery_pagination/README
Hi,
I stumbled upon an issue with event namespacing while developing a jQuery plugin.
here is the html
<div class="parent">
<div class="child">
</div>
</div>
<a class="btn-a">trigger a</a>
<a class="btn-b">trigger b</a>
<a class="btn-c">trigger c</a>
Here is the jQuery
jQuery('#content div.child')
.bind('child.a',function(){alert('a-child');})
.bind('child.b',function(){alert('b-child');})
.bind('child.c',function(){alert('c-child');});
jQuery('#content div.parent')
.bind('child.b',function(){alert('b-parent');})
.bind('child.c',function(){alert('c-parent');});
jQuery('a.btn-a')
.click(function(){
jQuery('#content div.child').trigger('a.a');
});
jQuery('a.btn-b')
.click(function(){
jQuery('#content div.child').trigger('a.b');
});
jQuery('a.btn-c')
.click(function(){
jQuery('#content div.child').trigger('a.c');
});
In sum, I have attached a namespaced event listener to the child and parent and created three buttons that trigger each of the events(a.a, a.b, a.c). Note the parent is only listening to a.b and a.c. When I click on the button that triggers a.a on the child, only the div.child listener for a.a is fired, but the entire 'a' namespace event bubbles up to div.parent listeners, a.b and a.c, and triggers them. My question is, how would I still use event namespacing but only have the intended event bubble up(i.e. a.a is the only event that fires for both child and parent). I am aware of stopPropagation and stopImmediatePropagation. I would not want to put these on the child a.b and a.c listeners because there are times when i do want them to bubble. For instance when I trigger 'a.b' on the child, I would expect the 'a.b' and only the 'a.b' event to be handled by the child and the parent.
Thanks
Here is what i have so far. I have it so they open in new windows, but i want it only if the check box is checked...
<!DOCTYPE html>
<html>
<head>
<script>
function new() {
if ( document.getElementById('checkbox').checked )
window.open( 'y', 'n', 't', 'New Window' );
}
else
{
break;
}
var OpenNew = document.getElementById('opennew');
OpenNew.addEventListener('click', OpenWin, false );
</script>
</head>
<body>
<p>
<form name="test">
<p>Open link in a new window <input type="checkbox" id="checkbox" name="check" /></p>
</form>
</p>
<p>
<h2>My favorite Websites to visit</h2>
<a href="http://www.youtube.com" target="new" id="y">Youtube</a><br />
<a href="http://www.newegg.com" target="new" id="n">Newegg</a><br />
<a href="http://www.twitch.tv" target="new" id="t">Twitch.tv</a><br />
</p>
</body>
</html>
I am unsure how to actually do the if statement if it is checked then open. It does currently open in a new tab.. i just need it to be only when its checked.
Any help with this will be greatly appreciated! Thanks!
Hi all,
I am implementing sliding panel element but problem is when i slide out other div element is floating down.
I guess and tried to give z-index to element which i am sliding but it doesn't seems to work.
Let me put code for both div.
<div class="vrcontrol">
<div class="slide-out-div">
<a class="handle" href="http://link-for-non-js-users.html">Content</a>
<h3>Contact me</h3>
<p>Thanks for checking out my jQuery plugin, I hope you find this useful.
</p>
<p>This can be a form to submit feedback, or contact info</p>
</div>
This is div which i am sliding in and out and beneath is code of effective div.
<div class="askform">
<p class="titletext">Ask an Expert Trade Forum</p>
<p class="detailtext">WD-40’s leading source for DIY tips and tricks.</p>
<span>
<form id="askform" name="askform" action="" method="post">
<span class="left"><input name="input" type="text" class="askinputbox"/></span><span class="marginleft"><input type="image" src="images/search_icon.gif" /></span>
</form>
</span>
<div class="followus">
<span class="followtext">Follow us on</span><span class="right"><img src="images/bookmark.jpg" width="121" height="45" alt="Bookmark" /></span>
</div>
</div>
Sliding div is in left portion of the page and effective div is in right portion of the page.
I guess something with z-index, positioning element and overflow properties will do something.
I'm trying to curve text this effect using CSS3, HTML Canvas, or even SVG (see image below for example)? Is this possible? If so, how can I achieve this effect?
I have a JSON feed (which I don't directly control, I have to ask the server admins to update it), that is returning NULL, or otherwise not working when I try to access it from another server. The actual feed works fine, but I can't get it to work like a normal API.
Why can I use Flickr, WhitePages, Twitter, etc's JSON APIs, but for:
http://portlandoregon.gov/shared/cfm/json.cfm
It returns NULL in the browser when using JS. If I call it on the same server, it's fine though.
If this is a server issue, what do I ask the admins to change, and if this is a local (browser) based issue, what am I doing wrong for this one feed that works for every other JSON API?
Hi all,
I am sorry that I have asked two questions in a few minutes.
In a html file, I got three child DIV tags in a parent DIV tag:
<div id="container">
<div id="frag-123">123</div>
<div id="frag-124">124</div>
<div id="frag-125">125</div>
</div>
Now when I click either the three child DIV tags, I will see two alert boxes pop up instead of one:
The first alert box will show something like this:
frag-123, and the second alert box will show something like this:
container
I dont know why.
I just want to get the ID value of a child DIV, not the one from the parent DIV.
<script>
$(function() {
$("div").click(function() {
var imgID = this.id;
alert(imgID);
});
});
</script>
Please help.
I try all methods but in my google map on the marker doesn't work events, I try enable events and write (clickable: true), but it did not help, in test server working good, but on phpfox marker not clickable, help me please correct it
go to it http://iguansystems.com/phpfoxdev/index.php?do=/pages/24/quickstart/step2/ link
login - [email protected], and pass- tryuser
in center frontend right at "Primary Venue" have "Can't find venue? Add New" click on "Add New" and window with a map open
I've got an input like so:
I'd like to use jQuery to grab that element, and add the function call foo() to the change event. Currently I can get it done, but there are two hacks involved. My (working) code:
$(":input[name*=myfield]").change(
function( $(":input[name*=myfield]") ) {
foo();
});
)};
There are two hacks in there I'd like to eliminate.
Keeping in mind that the input names are multidimensional arrays, how can I use the :input[name=somename], versus [name*=someone]? I'd imagine it's faster using an exact name rather than *=, but I can't get the escape sequence correct for the brackets on the multidimensional arrays.
Can I chain the call together so that I don't have to select the element twice? Is the standard practice for that to select the HTML element into a var, then use that var? Or can I chain it together?
Thanks for the help. Still working on getting my footing in JS/JQ.
I have a link button in a repeater control. the li element is drag and droppable using jquery. when the page loads the the link button works perfectly, the jquery that is attached and the server side code both execute. when I perform a drag and drop then click on the link button it doesn't not fire. when i click it a second time it does fire. If i perform 2 or drag and drops in a row the link button doesn't fire a as many drag and drops as i before it will fire. for example if if perform 3 drag and drops then it will take about 3 click before the events are fired.
<asp:Repeater ID="rTracks" runat="server" OnItemDataBound="rTracks_ItemDataBound" EnableViewState="true">
<ItemTemplate>
<li onclick="testclick();" class='admin-song ui-selectee <asp:Literal id="ltStatusClass" runat="server" />' mediaid="<%# Eval("MediaId") %>" artistid="<%# Eval("tbMedia.tbArtists.id") %>"><span class="handle"><strong>
<%--<%# int.Parse(DataBinder.Eval(Container, "ItemIndex", "")) + 1%>--%><%# Eval("SortNumber")%></strong><%--0:03--%></span> <span class="play"><span class="btn-play"> </span></span> <span class="track" title="<%# Eval("tbMedia.Title") %>">
<%# Eval("tbMedia.Title") %></span> <span class="artist">
<%# Eval("tbMedia.tbArtists.Name") %></span> <span class="time" length="<%# Eval("tbMedia.Length") %>">
<asp:Literal ID="ltRuntime" runat="server" /></span> <span class="notes"><span class="btn-notes">
<asp:Literal ID="ltNotesCount" runat="server" /></span></span> <span class="status">
<asp:Literal ID="ltStatus" runat="server" /></span> <span class="date">
<%# Eval("DateAdded") %></span> <span class="remove"><asp:LinkButton ID="lbStatusClass2" runat="server" CssClass="btn-del" OnClick="UpdateStatus" ValidationGroup='<%#Bind("MediaId") %>'>
<%--<span class='<asp:Literal id="ltStatusClass2" runat="server" Text="btn-del" />'>--%>
<%--</span>--%></asp:LinkButton></span></span> </li>
</ItemTemplate>
</asp:Repeater>
I have onclick event on the li element, when the mouse is clicks the link button the li onclick event is fired even when linkbutton event doesnt fire. My question is if the li captures the event y doesnt the event fire on the linkbutton? What would be stopping the event?
Hello guys,
A quick question: how do I programatically select the text fragment of the page in FireFox? For example, there's a paragraph of text, user clicks the button and symbols from 10-th to 15-th are selected as if user dragged a mouse in a regular way.
Im using an existing widget from the jquery-ui labs call selectmenu. It has callback options for the events close and open. The problem is i need in these event to animate a node that is part of the widget but not what its connected to. In order to do this i need access to this node.
for example if i were to actually modify the widget code itself:
// ... other methods/properties
"open" : function(event){
// ... the original logic
// this is my animation
$(this.list).slideUp('slow');
// this is the orginal call to _trigger
this._trigger('open', event, $this._uiHash());
},
// ... other methods/properties
However when in the scope of the event handler i attach this is the orginal element i called the widget on. I need the widget instance or specifically the widget instance's list property.
$('select#custom').selectmenu({
'open': function(){
// in this scope `this` is an HTMLSelectElement not the ui widget
}
});
Whats the best way to go about getting the list property from the widget?
Hi, all,
I tried to put the module "LearnBoost's Socket.IO-Node", all works, except event 'onClientMessage'
Tell, in what there can be a problem, thanks!
...sorry for my english
io.listen(server, {
onClientConnect: function(client){
client.send(json({ buffer: buffer }));
client.broadcast(json({ announcement: client.sessionId + ' connected' }));
},
onClientDisconnect: function(client){
client.broadcast(json({ announcement: client.sessionId + ' disconnected' }));
},
onClientMessage: function(message, client){
var msg = { mess: [client.sessionId, message] };
buffer.push(msg);
if (buffer.length > 15) {
buffer.shift();
}
client.broadcast(json(msg));
}
Hello all,
I'm trying to get the text contents of a .div('.child#') child of my event.target('h6.class'), and replace my other headers('h1.replacHeader#') using this script below...
$('h6.class').click(function(event) {
var $target = $(event.target);
$('.replaceHeader1').replaceWith("<h1 class='replaceHeader1'>" + $target.children(".child1").text() + "</h1>");
$('.replaceHeader2').replaceWith("<h1 class='replaceHeader2'>" + $target.children(".child2").text() + "</h1>");
});
});
I've noticed that .text() apparently doesn't apply to an event.target... So how could I go about achieving this?
Hello Everyone.
I am new to Jquery. I want to read specific data(some div's only) from a webpage and store it in my database. Now I am not able to do so as load functions loads the data into the current page id. My goal is to read specific data and store them in database. So which Jquery function should I use for this? if someone can throw some light on it, it would be really helpful for me.
I am using JSP,MySQL,Java.
$("li").hoverIntent({
sensitivity: 3,
interval: 200,
over: addOver,
timeout: 500,
out: removeOver
});
function addOver(){ $(this).addClass('over').children('a:first').addClass('active');}
function removeOver(){ $(this).removeClass('over').children('a:first').removeClass('active');}
alert ('version 2 menu');
});
On mouseout I want to remove class of " li a" if it already dont have class.
I want to remove the class of the children.
In an Adobe Air AJAX application with multiple windows running on a system with multiple (three or more) monitors, can you maximize the windows in each monitor? I've seen posts by others trying to do this, but I've not seen anyone saying how it worked out.
I basically need to build a 'status monitor' system (similar to, say, an airport departures monitor) in which there are public-facing displays that need to look and feel like single-purpose, embedded applications -- no window chrome and no visible desktop. I don't think this should be any different from any other windows application, but I don't know about Air. I have a dual-monitor Mac setup right now, but I can't easily test Windows and I likely will never be able to test three monitors at once.
This application will be run as an AJAX Air application written in Aptana (or DW if it makes a difference).
Let's say I want to use this API: http://hiveminder.com/help/reference/API.html
The instructions walk through its use via. the curl command line tool, which I'm unfamiliar with. I want to access this API through a simple script on my own page. What are the steps I need to do this?
I have a page with 2 frames. In the top frame is a form called invoice.php. In it you type in an invoice number and then post it. I am wanting this post to be sent to 2 pages that will open in both the top and bottom frames. The top page is called invoicelab.php and the bottom is called invoice2.php. The information that I am posting is called workorder. The form page looks like this - ---
Enter workorder number
What is the best way to pass this information onto both invoice2.php and invoicelab.php. Thanks