Function Runs Once, Error On Second Call?

Mar 8, 2010

I have a function which is called twice. It allows the elements of an array to be set to a different color, successively:

function ln8 (arrayA,color,current) {
var arrayB=(typeof arrayA == 'string')? arrayA.split(',') : arrayA;
var line = document.getElementById(arrayB[current]);

[code]....

View 8 Replies


ADVERTISEMENT

JQuery :: Conditionally Looping Through Array - Determine If The Function That Runs The Ajax Call Has Succeeded Or Not?

Oct 11, 2011

I've got an array of names, and one ID. I need to run an ajax call using the ID and each lastname, until I get a successful hit on the ajax call. I can't quite figure out how to determine if the function that runs the ajax call has succeeded or not, it always returns false for me... Here's the code for the loop:

[Code]...

View 2 Replies View Related

Call Function Only If Another Function Does Not Return Error?

Feb 14, 2011

I'm trying to "progressively enhance" one of my surveys using javascript. Basically, I have rating scales that make use of radio buttons as each point on the scale. Each radio button occupies its own cell in a table. I wrote some functions that will highlight cells on mouseover in a color corresponding to its position on the scale (e.g. the lowest point is red, the midpoint is yellow, the highest point is green). When a radio button is clicked, the background of the button's cell and preceding cells in the same row will be colored accordingly. The functions are working well in FireFox and Chrome (I just have to add a few lines using the addEvent function to make it compatible with IE).

The effect looks a lot nicer when I add a function that makes the visibility of the radio buttons hidden.

However, I want to make sure that there is a fallback option in case the functions that color the cells don't work for whatever reason. I would not want the radio buttons hidden in this case.

Is there a method whereby I can call the "hideRadiobuttons" function only if the other functions are successfully executed?

View 8 Replies View Related

Fatal Error Call To Undefined Function PHP

Mar 15, 2011

I know I shouldn't be having this problem at this stage. But what have I done wrong?I have my main page, I have my onload page and in that onload page I call a function:And then I get the error message:Fatal error: Call to undefined function OpenChat.Needless to say I am trying to create an instant chat.

View 26 Replies View Related

Simple Calculation - Error On Function Call

Aug 15, 2011

I have written the following javascript code which makes a simple calculation and writes between the <span> tags using Inner HTML

My code is:
Code:
<html><head>
<script type="text/javascript">
function hesapla() {
kredimiktari = document.hesapla.miktar.value
kredivadesi = document.hesapla.vade.value;
faiz = document.hesapla.faiz.value;
ayliktaksit1 = (kredimiktari * faiz) / kredivadesi;
geriodeme1 = kredimiktari * faiz;
document.getElementById('ayliktaksit').innerHTML = "<strong>Taksit / Ay :</strong>" + ayliktaksit1;
document.getElementById('geriodeme').innerHTML = "<strong>Taksit / Ay :</strong>" + geriodeme1;}
</script></head><body>
<form name="hesapla">

<input type="text" name="miktar" value="Kredi Miktarı" onfocus = "if (this.value == 'Kredi Miktarı') this.value = '';" onblur = "if (this.value == '') this.value = 'Kredi Miktarı';" />
<input type="text" name="vade" value="Kredi Vadesi" onfocus = "if (this.value == 'Kredi Vadesi') this.value = '';" onblur = "if (this.value == '') this.value = 'Kredi Vadesi';" />

<input type="text" name="faiz" value="Faiz Oranı" onfocus = "if (this.value == 'Faiz Oranı') this.value = '';" onblur = "if (this.value == '') this.value = 'Faiz Oranı';" />
<div id="gosterim"><span id="ayliktaksit"></span><span id="geriodeme"></span></div>
<input type='button' value='Hesapla' onClick='hesapla()'><br><br>
<img src="images/dot2.png" width="180" height="2" alt="dot"/>
</form></body></html>

I am really confused as similar code on Tizag web site works fine.
Code:
<script type="text/javascript">
function changeText(){
document.getElementById('boldStuff').innerHTML = 'Fred Flinstone';
}</script>
<p>Welcome to the site <b id='boldStuff'>dude</b> </p>
<input type='button' onclick='changeText()' value='Change Text'/>

View 2 Replies View Related

Function Only Runs 33 Percent Of Time When Called?

Feb 23, 2010

function update(value1){
doAjax("behind_scan.php" , "id="+value1);
}function doAjax(url , str ){
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null){
alert ("Browser does not support HTTP Request");
return;
}url=url+"?"+str;
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}function stateChanged(){
if (xmlhttp.readyState==4){
//document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
//alert(xmlhttp.responseText)
document.forms.myform.scanner.value = "";
document.forms.myform.scanner.focus();
}}function GetXmlHttpObject(){
if (window.XMLHttpRequest){
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}if (window.ActiveXObject){
// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
} return null;
}

This pages calls a function on a separate php page to run 2 mySQL queries, the value must be put in the text 3 times in quick succession before the database is altered. I've tried all the other functions and they seem to be fine, AJAX is my weakness but I need it for the main functionality of my website. I need this to work.

View 2 Replies View Related

Having A Link Which Runs A Js Function (acceptable To Have No Href?)

Jul 17, 2006

question: if you want a link which simply runs a js function is it acceptable to have no href? the problem with this is the cursor doesnt change when you hover over, but if you put # as the href it jumps to the top of the screen which is sometimes unacceptable. what it the best solution to this? granted you could do event handling behind the scenes and just intercept the clicks and prevent the href from going anywhere, but sometimes you just want to stick an onclick on the anchor tag!

View 5 Replies View Related

JQuery :: Function Runs Before HTML Updated By Ajax

Aug 21, 2011

Problem in the timing of the script. The problem is that when I try to get an id of an object that was added by ajax, the script doesn't recognize it. The html:
<select id="categories" name="categories">
<option value="3">aa</option>
<option value="43">bbb</option>
</select>

When I load the page, there is this script that get the value of the #categories and use ajax to fill another select and in the same ajax, I load images by another function using the new select input that was created:
function fill_subcategories(){
parent=$("#categories").val();
$.ajax({
type: "post",
url: "ajax/sub_galleries.php",
data: 'parent='+parent,
success: function(data){
$('#sub_categories').html(data);
}});
show_exist_imgs()
}

This fills this div:
<select name="sub_categories" id="sub_categories"></select>
Right after filling the #sub_categories, I use another ajax that get images of the new id of the #sub_categories, and here I get the problem.. the js:
function show_exist_imgs(){
g_id=$('#sub_categories').val();
$.ajax({
type: "post",
url: "ajax/show_exist_imgs.php",
data: 'g_id='+g_id,
success: function(data){
$('#exist_files').html(data);
}});
}
This script doesn't recognize the id of the new $('#sub_categories') select input.. why is that?

View 2 Replies View Related

JQuery :: Check Event Layout - Function Runs Twice

Nov 4, 2009

I have created some code that alerts me the contents of all the child divs inside a main div

function CheckEventLayout(){
//check all divs in area and resize overlapping divs
var RunOnce;
if( RunOnce != true ){
var StartTimes = new Array();
var EndTimes = new Array();
var i = 0;
$("div#day-view-overlay").children("div.day-view-appointment").each(function(){
var DoOnce;
if( DoOnce != true ){
alert($(this).html()); .....
CheckEventLayout();

The problem is this code is on a page that is loaded via post and if you go off the page and then back onto it jquery seems to attach the function again so it runs twice. So need to unbind this function before the script runs again.

View 2 Replies View Related

Get An Audible Click Sound File To Run Every Time The Function Runs

Apr 27, 2011

I have a self project I am exploring. I would like to play a simple sound file each time a function is run. The function runs every second, so, basically, I am just trying to get an audible click sound file to run every time the function runs. I do not know how to play a sound file thru javascript. Here is the code file thus far...

<html>
<head>
<title>Timer</title>
<link href="timer.css" rel="stylesheet" type="text/css" />
<embed src="click.wav" autostart=false hidden=true name="sound1" enablejavascript="true">
<script type="text/javascript">
var seconds = 0;
[Code]...

View 7 Replies View Related

JQuery :: Search Function Runs Multiple Times When Grouped

Dec 19, 2010

If this search function is included in an include file with other functions it will run more than once if you click another function first, then come back to it to do another search.

Code:
$(document).ready(function() {
$("a#searchowner").click(function() {
var searchval=$("#p1").val();
alert(searchval); //test alert box
$.post("findowner.php", {p1 : searchval}, function(data){
if (data.length>0){
$("#ownerIDdiv2").html(data);
}});
});
}); //end

For example if I click the next page function, then decide to click for a new search it runs more than once:
Next page function:

Code:
$(document).ready(function() {
$('a#nextpage').click(function() {
var page = $(this).attr('page');
var searchval = $(this).attr('schval');
var maxpage = $(this).attr('maxpage');
$.post("findowner.php", {
p1 : searchval,
page : page
}, function(data){
if (data.length>0){
$("#ownerIDdiv2").html(data);
} });
});
}); //end

However, if I put the first search function in a separate include file all works perfect. Why it runs multiple times if it is grouped among other functions?

View 14 Replies View Related

Function Call With Quotes Inside Another Function Call?

Feb 11, 2006

<button onClick="return popup('<span onClick='selectShape(1, 1, 1)'>test<span>');" tabindex=&#393;' onFocus="setFocusColor(0,3)">....</button>
This will work perfectly, but as soon as I need to pass Strings inside the selectShape function, I get stuck.

So the question is, how can I create the following and have it working

......selectShape(2, 'Tricky', &#3940;x5°').....

View 1 Replies View Related

JQuery :: () Call: Success In IE, Error In Firefox?

Jan 15, 2010

why the following code results in an error in Firefox and success in Internet Explorer?

jQuery.ajax({
type:"GET",
url:"http://nl.ae/iptocapi.php",

[code]....

No matter what I put in here, Firefox is going into the error; will not return success.What the server returns is just plain text, no html, thinking maybe it has something to do with This, but I can't figure it out because there are only So many options for

View 6 Replies View Related

JQuery :: IE8 And Apparently Error On .button() Call?

Nov 29, 2011

I'm Matteo and i have some problem with my website with jquery on IE8 browser. In the site I have a filter bar, partially crated with jquery. The code is that: <div id='filter_area_icons'>

<span><img src='/img/types_ico/small/1.png'id='ico_type_1'></img></span>
<span><img src='/img/types_ico/small/2.png'id='ico_type_2'></img></span>
<span><img src='/img/types_ico/small/3.png'id='ico_type_3'></img></span>
<span><img src='/img/types_ico/small/4.png'id='ico_type_4'></img></span>

[Code]...

View 2 Replies View Related

Second Call To Fuction Gives Object Required Error

Feb 21, 2002

I'm trying to build a cascading menu in javascript I got as far as this ; all I want to do is Re-draw the whole page when the link is clicked however I get an object required message the second time the link is clicked (I,m using IE 5) Code:

View 5 Replies View Related

JQuery :: Browser Stop Call's Ajax.Error

Sep 13, 2009

I've noticed that when I click the Stop button on the browser, or navigate to another page, jQuery.ajax calls the error event. You can see the problem live at: [URL]..

[Code]...

View 3 Replies View Related

JQuery :: Error In IE: Unexpected Call To Method Or Property

Sep 24, 2009

I'm using jquery-1.3.2.min.js and everything works perfectly in browsers other than Explorer... It's not liking this part:

this.appendChild(E)
function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})} ... }
I get this error:Unexpected call to method or property access. jquery-1.3.2.min.js, line 12 character 2305

View 1 Replies View Related

IE Error - Unexpected Call To Method Or Property Access

Aug 15, 2009

This error ONLY occurs in IE. "Unexpected call to method or property access."
I pinpointed it to this line:
o.appendChild(e);

The full function is:
function aO(d, t, src, p, id ){
alert('aO has begun.');
var o, e, i;
if (!ie){ o = cE('object');o.data = src; }
else { o = cE('embed');o.src = src; } .....

View 3 Replies View Related

Jquery :: Error When Calling Web Service From Ajax Call

Mar 30, 2010

I am calling web service through jquery ajax call for the first time and getting an error.

Below is the code:

Here is JScriptuserNTID.js file:

Here is WebService.asmx/HelloWorld:

View 1 Replies View Related

JQuery :: AJAX Cross Domain Call - 200 But Still Getting Firebug / Js Error

May 4, 2011

I trying to make a call to an external domain using $.ajax() and it WORKS, the server receives the call, but the response in firebug errors out in jquery.js line 7760. I've been beating my head at this all day and don't feel like I've made it much further.

I suspect it has something to do with the dataType or type of the request. But I've tried all kinds of things from POST to GET to JSONP in the type. For dataType, I've also tried "html", "text", "xml", "json", and even some combos of "text html" but no success.

[Code]...

View 13 Replies View Related

JQuery :: Ajax Call - Getting Permission Denied Error On Same Domain

Jul 12, 2010

All I'm doing righthere is calling a Perl script on an intranet server and using the xml results to popluate a <select> element. This works on my machine but a co-worker is getting a "Permission Denied" error when this function is executing onReady

function
populateGroups(){
var p = 1;
var groupNames = new
Array();
$.ajax({
type:"GET", .....

I had him run a tracert to that server and we all connected through the same network devices... And this works on a couple of other co-worker's computers. He also does have access to that server so that he can type in the url and get the xml results...

View 1 Replies View Related

JQuery :: Call The Delete/refresh Function From Outside The Event's Function Scope?

Apr 4, 2010

I'm wanting a table cell click event to remove and replace the table it was clicked on, however I'm finding that as it's deleting the original table object the actual running event code is being replaced and the function is bailing.how I can call the delete/refresh function from outside the event's function scope?

View 1 Replies View Related

JQuery :: Wrap Elements From An External JS File Into A Function Then Call That Function?

Feb 12, 2010

how I can accomplish wrappingrelevantparts of a script into a function then call that function within a success area on another page.

This is what I have so far: Script.js page - This page is longer but this is the relevant part that I would like to wrap:

$(".product img").draggable({
containment: 'document',
opacity: 0.6,
revert: 'invalid',

[code]....

View 3 Replies View Related

JQuery :: Call Back Function - Should The 1st Parameter Of The Get Function Be A HTML File

Jun 23, 2010

I have just started learning JQuery and have a doubt in the below code. $.get('myhtmlpage.html', myCallBack);The doubt is should the 1st parameter of the get function be a HTML file or can it be a unction name?

View 1 Replies View Related

Call Function In Script And Pass One Parameter To Function And Its Returns String Value?

Feb 15, 2012

I want to call java function in javascript.In which we pass one parameter to function and its returns String value which I want to display in alert message.

View 2 Replies View Related

JQuery :: Checkboxes Won't Make A Call To UpdateResults Function Within $function()?

Jun 11, 2011

I have a real perplexing issue. In two separate "projects" I had code that displayed checkboxes - when clicked, they would fetch information from a db and display it in the div below. I had code that displayed a jquery date-picker - when clicked, it would fetch information from a db and display it in the div below. My issue comes with this:

[Code]...

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved