Hi,
I have an auto overflowed DIV on my page, what i want to do is to make it start scrolling slowly towards the end of items of the DIV on page onload.
is that easy u think ?
I have DHTML content inside a fieldset. This includes plain html, nested objects (even other fieldsets), and value change of input, select, and textarea objects.
I'd like to change the border of the fieldset if the contents have been changed.
The following works:
$('fieldset[name=qsfs127]').children('input').change(function(){
$(this).parent('fieldset').css({border:'1px solid red'});
})
This handles the input; I can extend it to select and textarea.
Questions:
How can I do the same for html changes?
Can all of this change-tracking be done by comparing current html() to stored one?
If yes for (2), will this handle cases of "undo"?
Edit: I have a button that ajax-uploads contents, and saves the changes. I then remove the border color
I am trying to combine a keydown event with a mousedown event. Basically, I have a chat dialog, and if the user writes in one of 2 divs (keydown event) or makes a selection from either (or both) of 2 dropdowns (mousedown), I need these to have the same exact function. Thanks in advance.
Code (to be combined):
$('#usermsg').add('#otherComments').keydown(function() { // When key pressed
and
$('#strategies').add('#whySwitch').mousedown(function() { // When mouse is clicked
//function body
});
i'm using the below javascript to change an image on an aspx in asp.net c#
<script language="JavaScript" type="text/javascript">
var updateImageWhenHashChanges = function()
{
theImage = document.getElementById("ctl00_ContentPlaceHolder1_Image1a");
if(window.location.hash == "#size=2")
{
theImage.src = "<%# Eval("realfilename", "/files/l{0}") %>";
}
else if(window.location.hash == "#size=3")
{
theImage.src = "<%# Eval("realfilename", "/files/{0}") %>";
}
else if(window.location.hash == "#size=1")
{
theImage.src = "<%# Eval("fullthumbname", "/thumbnails/{0}") %>";
}
else
{
}
}
</script>
here's how i call it with a link
<a href="#size=3" onclick="updateImageWhenHashChanges();">test</a>
the problem is that it only does what i'm expecting on the SECOND click of the link, because it seems onclick fires before the href, so the first time i'm just placing the var and the 2nd time i'm actually getting what i want.
does anyone know how i can fix this? i'm trying to get the image to change on each click
I have a script for a website, and one of the things ti does right at the end if attempt to disable an anti-right click protection in a website
if($("span[class=MembersNameDisplay]").exists()){
var list_row = document.getElementsByTagName('script');
if(list_row != null){
list_row[0].parentNode.removeChild(list_row[0]);
}
}
document.oncontextmenu=new Function("return true");
In google chrome this works, however in firefox with greasemonkey, the last line fails and the protection is not removed.
Error: Component is not available Line: 171
How do I fix this, and why does it fail under firefox?
I have a big div wit a lot of smaller divs within it. Say,
<div id="parent">
<div id="child1">
</div>
<div id="child1">
</div>
<div id="child2">
</div>
<div id="child1">
</div>
<div id="child1">
</div>
</div>
If I'm currently at the last 'child1', how dow I get to the top most child1 with prev()? For me it breaks when it reaches 'child2'.
I'm attempting to extract the following data from a table via Android / JSOUP however I'm having a bit of trouble nailing down the process. I think I'm getting close to being able to do this using the code I've provided below - but for some reason I still cannot get my textview to display any of the table data.
P.S.
Live URL's can be provided if necessary.
SOURCE:
public class MainActivity extends Activity {
TextView tv;
final String URL = "http://exampleurl.com";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv = (TextView) findViewById(R.id.TextView01);
new MyTask().execute(URL);
}
private class MyTask extends AsyncTask<String, Void, String> {
ProgressDialog prog;
String title = "";
@Override
protected void onPreExecute() {
prog = new ProgressDialog(MainActivity.this);
prog.setMessage("Loading....");
prog.show();
}
@Override
protected String doInBackground(String... params) {
try {
Document doc = Jsoup.connect(params[0]).get();
Element tableElement = doc.getElementsByClass("datagrid")
.first();
title = doc.title();
} catch (IOException e) {
e.printStackTrace();
}
return title;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
prog.dismiss();
tv.setText(result);
}
}
}
TABLE:
<table class="datagrid">
<tbody><tr>
<th>Item No.</th>
<th>Name</th>
<th>Sex</th>
<th>Location</th>
</tr>
<tr>
<td><a href="redirector.cfm?ID=a33660a3-aae0-45e3-9703-d59d77717836&page=1&&lname=&fname=" title="501207593">501207593 </a></td>
<td>USER1</td>
<td>M </td>
<td>Unknown</td>
</tr>
<tr>
<td><a href="redirector.cfm?ID=edf524da-8598-450f-9373-da87db8d6c84&page=1&&lname=&fname=" title="501302750">501302750 </a></td>
<td>USER2</td>
<td>M </td>
<td>Unknown</td>
</tr>
<tr>
<td><a href="redirector.cfm?ID=a78abeea-7651-4ac1-bba2-0dcb272c8b77&page=1&&lname=&fname=" title="531201804">531201804 </a></td>
<td>USER3</td>
<td>M </td>
<td>Unknown</td>
</tr>
</tbody></table>
here is the script does what i want but not exactly,
my question is, how can i stop user entering text once it reached the lmit of 255 characters?
var limit = 255;
var txt = $('textarea[id$=txtPurpose]');
$(txt).keyup(function() {
var len = $(this).val().length;
if (len > limit) {
//this.value = this.value.substring(0, 50);
$(this).addClass('goRed');
$('#spn').text(len - limit + " characters exceeded");
return false;
}
else {
$(this).removeClass('goRed');
$('#spn').text(limit - len + " characters left");
}
});
if there is a better way please let me know.
My site is for listing theatrical productions
(http://theaterOnline.com)
I want to use a drop down list to enable users to filter the listings by location or genre.
The following code refreshes the screen:
$("#cfilter").change(function() {
$('#calendar').fullCalendar('refetchEvents' )
})
but I need to be able to change SRC in the ajax call below:
$.ajax({
url: src,
dataType: 'json',
data: params,
cache: options.cacheParam || false,
success: reportEventsAndPop})
which is a passed parameter from eventSources[1]
TIA for anyone who can help!
I have added the nivoslider and prettyphoto lightbox to a page. What I am trying to do: when you click one of the nivoslider images, prettyphoto should load a video. Everything works ok, except that whenever the nivo slider is sliding the images, the video in prettyphoto lightbox is reloading. How can I prevent the video from reloading once the sliding images are changing?
I am not a javascript nija but I am guessing it can be done with changepicturecallback: function(){} from prettyphoto...
How to show mouseover tooltip on selected word on web page using javascript? i want to set some conditions
For example:
If page has text <p> I'm Web Designer </p> inside <div id=example> then it should show tool tip on Designer but tooltip should not be shown for designer without adding any span to Designer and designer. i want to select autuomatically
I have to set include and exclude keywords to pick, or notpic tool tip . and matter of all tooltips for all i want to write in another html file not in same page.
following code remove div on runtime. I have written code perfectly but it did not delete or hide the div.
$(document).ready(function() {
$("#metainfo > input").live('click', function() {
$("#div" + this.id).fadeOut("slow");
});
});
Is there a way to map an event such as a click-event on this element
<div>Just normal text</div>
to the position in the contained text ( "You just clicked the 6th character", when hitting the 'n' )?
I am using mod_rewrite to remap the URLs in my website in the following format:
http://www.mydomain.com/health/54856
http://www.mydomain.com/economy/strategy/911025/
http://www.mydomain.com/tags/obama/new
The problem is that I am making AJAX calls to a file: http://www.mydomain.com/login.php
And I don't want to write the FULL url or even use the ../ trick because there isn't a fixed level of folders.
So, what i want is something to access the login.php from the root, whatever the domain name is:
$.ajax({
type: "POST",
url: "http://www.mydomain.com/login.php"
});
I am getting error but empty statusText, here is my code
var ajaxUrl = 'https://graph.facebook.com/me?access_token=' + accessToken
$.ajax({
url: ajaxUrl,
dataType: 'json',
success: function(user){
alert('h');
},
error: function(xhr, ajaxOptions, thrownError){
alert(xhr.statusText);
}
});
In my javascript I create my <OBJECT> tag
var htmlEmbedSilverlight = "<div id='silverlightControlHost'> "
+ "<object data='data:application/x-silverlight-2,' type='application/x-silverlight-2' width='550px' height='250px'> "
+ "<param name='source' value='../../ClientBin/FotoEmprestimoChave.xap'/> "
+ "<param name='onError' value='onSilverlightError' /> "
+ "<param name='background' value='white' /> "
+ "<param name='minRuntimeVersion' value='4.0.60310.0' /> "
+ "<param name='autoUpgrade' value='true' /> "
+ "<param name='initparams' values='chave_id=" + data + "' /> "
+ "<a href='http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.60310.0' style='text-decoration:none'> "
+ "<img src='http://go.microsoft.com/fwlink/?LinkId=161376' alt='Get Microsoft Silverlight' style='border-style:none'/> "
+ "</a> "
+ "</object><iframe id='_sl_historyFrame' style='visibility:hidden;height:0px;width:0px;border:0px'></iframe></div>";
$("#tiraFotoSilverlight").html(htmlEmbedSilverlight);
This is a reference to my Silverlight application where I call in my Web Application. The problem is my <param name='initparams' values='chave_id=" + data + "' /> " because in my App.xaml in Silverlight, I have the code below
private void Application_Startup(object sender, StartupEventArgs e)
{
if (e.InitParams != null)
{
foreach (var item in e.InitParams)
{
this.Resources.Add(item.Key, item.Value);
}
}
this.RootVisual = new MainPage();
}
Where InitParams always has Count = 0 and I don't know why. Can someone help me ? I'm just trying to pass a value to my Silverlight application, without a PostBack.
Rendered
<object width="550px" height="250px" type="application/x-silverlight-2" data="data:application/x-silverlight-2,">
<param value="../../ClientBin/FotoEmprestimoChave.xap" name="source">
<param value="onSilverlightError" name="onError">
<param value="white" name="background">
<param value="4.0.60310.0" name="minRuntimeVersion">
<param value="true" name="autoUpgrade">
<param values="chave_id=1" name="initparams">
<a style="text-decoration:none" href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.60310.0">
</object>
I want to add to this simple file ... When you click on a tab updated contents of the page or reload
$(function(){
$('#tabsSlide #nav li a').click(function(){
var currentNum = $(this).attr('id').slice(-1);
$('#tabsSlide #nav li a').removeClass('current');
$(this).addClass('current');
$('#tabsSlide #content .tab-slide').slideUp(300);
$('#tabsSlide #content #slide-'+currentNum+'.tab-slide').slideDown(300);
});
});
how i can do this.
if user want to closed his window without saving then show a confirm error that "are you really want to closed the window".
how i can do this
This pertains to a form wizard with 5 steps, I don't want the user to hit back and lose form data in any step 2-4. I have added a flag for the submit function and need to add this one for the first step. If they get there by accident and try and leave I dont want the cofirm dialog popping up.
<script type="text/javascript">
$(document).ready(function(){
var action_is_post = false;
$("form").submit(function () {
action_is_post = true;
});
//this is the trouble spot. on the first step the "navigation" of the form has a class
of current (on step one = current)
$(this).ready(function () {
if ($("#stepDesc0").is(".current")) {
action_is_post = true;
}
);
window.onbeforeunload = confirmExit;
function confirmExit()
{
if (!action_is_post)
return 'Using the browsers back, refresh or close button will cause you to lose all
form data. Please use the Next and Back buttons on the form.';
}
});
</script>
Hello,
I am working on my personal site, where I want to store my customers recent search result limited to that particular session.
I am using PHP platform and Javascripts.
Here is an example of what I am exactly looking at :
It stores your previously searched domain name for that particular session so that user can make decision by comparing those results.
How to achieve this using php, javascripts or some sort of div layer ????
Thanks.
Hi All,
I want to set the starting slide manually for the cycle plugin without using pager. It is not working for me.
Code:
$('#divTrac').cycle({
fx: 'scrollHorz',
speed: 1500,
next: '#leftt',
prev: '#rightt',
startingSlide: 2,
timeout: 0, continuous: false,
pause: 1, sync: 1,
nowrap: 1,
slideExpr: '#myTrack'
});
I have a variable that contains some text, some html, basically can be a string. I need to search the variable for a specific string to process that variable differently if it is contained. Here is a snippet of what I am trying to do, does not work obviously :)
$.each(data.results,
function(i, results) {
var text = this.text
var pattern = new RegExp("^[SEARCHTERM]$");
if(pattern.test( text ) )
alert(text); //was hoping this would alert the SEARCHTERM if found...
I have this script where I use a slider to show some elements of a form. So far so good. The way I'm doing it is by having a slider (can't use a multistep form since it uses a plugin not allowing multistep forms, plus some graphic behaviors) and a button that goes to the next slider. So now I need that button (not part of the form) to show only if a certain field is filled.
I tried teh following, but it's not working, I assume some error but can't figure what. My code is as follows:
$('#clientname').change(function() {
var clientVal = $("input").val() == '';
$(".next").hide();
if ($('#clientname').val() != '').show();
else
$('.next').hide();
});
and the html as follows:
<div class="b40-right">
<h3>The Basics</h3>
<div class="label"> Your Name (required)</div>
<div class="inputes"> <span class="wpcf7-form-control-wrap your-name"><input id="clientname" type="text" name="your-name" value="" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" size="40" /></span> </div>
<div class="label">Your Email (required)</div>
<div class="inputes"> <span class="wpcf7-form-control-wrap your-email"><input type="text" name="your-email" value="" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" size="40" /></span> </div>
<div class="label">Type of Business</div>
<div class="inputes"> <span class="wpcf7-form-control-wrap type-of-business"><textarea name="type-of-business" class="wpcf7-form-control wpcf7-textarea" cols="40" rows="10"></textarea></span> </div>
</div>
<a class="next" href="javascript:stepcarousel.stepBy('mygallery2', 1)"><img id="nextbut1" src="<?php bloginfo('template_directory'); ?>/images/next.png" alt="" /></a>
any help on what am I doing wrong? Is there a better approach/solution? (I'm not a programmer as you may figure)
Thank you in advance!
Hi,
I have an app that loads an ajax form when a button is clicked. I then want to check a value in that ajax loaded form called "comment_content" so that I don't send an ajax request if the comment_content is empty. I can capture the form submission using the live method, however, I can't capture the form element because it needs an element.
I was looking at livequery but was wondering if there is a more efficient way by using live or if that I shouldn't even bother? Your help is very much appreciated.
$("#comment_submit").live('click', function(){
var comment = $("#comment_content").html();
if(comment == ""){
$("#notice").html("").stop(true, true);
$("#notice").append("<p>Are you going to write something in that comment?</p>");
$('#notice').slideDown().delay(2000).slideUp();
return false;
}
return true;
});