Trouble With Loop With Conditional In It

Mar 26, 2010

This is the loop I'm trying to use to check for bullets hitting rocks. the function worked if I used actual numbers instead of the j variable, but I wanted to loop through all the rocks.Can anyone see why the inner function loses the j index and says asteroids[j] is undefined? the hit test is removing the bullets! it's working! the asteroids[j] was used in the hit test!

View 6 Replies


JQuery :: Trouble With Php While Loop And $.post

Aug 4, 2011

My website is an Magic the Gathering website, so it involves card,cardsid,decks etc.I have a searchresult.php page, which shows the results(cards) after you an SQL query has searched through my SQL database.Then every result get's a links(add card to deck) behind it which opens an unique popup window.Now my problem is, in this popup there must be an unique form which check via ajax whether the 'card' is already in the deck. Well I got as far as this works, well it does for my first search result.Altough the input's are unique in every popup, as they should be. Only the values of the input's of my first searchresult are submitted to the process form.

The includes of the Jquery files is not included in this code, but it is included in the real code. it is in a seperate file, it would be stupid to just show I include the jquery library and files xP, because that IS the case.[code]

View 6 Replies View Related

Conditional Statement W/i A Loop Correct Syntax

May 3, 2011

Code? What is the correct way to write it.

Rules: create an array for the user to type 5 strings in a prompt that will be displayed in an alert box.

User must type in the prompt an alert will display what the user typed if the prompt is empty or contains nothing an alert will display telling the user to enter text user clicks ok on the alert box and is sent back to the prompt box

View 14 Replies View Related

Trouble With <OBJECT>

Jul 20, 2005

I would live to find a different way to do this, but evidentially I am not able
to open a Text-File in JAVASCRIPT and fill an Array with the Values, so I have
to do it this way.

I am doing the following:

View 3 Replies View Related

Onclick Trouble

Aug 27, 2007

I'm using 'this' so that only the element that is clicked changes, what I need is some way of specifying a background color for anything that isn't 'this' and then continue to change the clicked element. Is this possible? The only other way I can think of is to add a class to each menu item and then only apply the backgroundColor = "Transparent" if the class of the clicked element matches that stored in a variable and other wise apply the standard background color. Though I may be shooting wide of the mark. Code:

View 3 Replies View Related

IE DOM Iframe Trouble

Mar 30, 2007

I know this is really more of a DOM or IE DOM question than a js one but the js forum seems to be the most fitting...

I am working on a page where I have included an instance of FCK Editor (which is just a script that creates your standard Rich Text Editor interface inside a form).

What I want to do is call a function which retrieves the newly typed data (along with the formatting) and does something with it.

The "problem" is that FCK creates it interface inside an Iframe inside another IFrame. No problem for FireFox, Netscape, etc... It just a matter of a couple "getElementById()"s and "contentDocument"s. However IE does not support contentDocument. Instead IE puts all Frames (including IFrames) in the frames array. Which is fine, I can still navigate my way down the tree to my target Iframe with document.frames[0].frames[0]... the trouble is, you cannot (or I can't figure out how) to access elements on the page inside the nested Iframes. I can access properties of the Iframes (such as location).

I'm thinking that this is how IE is "supposed" to work but is there any way that I can access elements inside a page inside of an Iframe or nested Iframes? Code:

View 1 Replies View Related

Cookie Trouble In IE

Dec 20, 2007

I'm using the following line to delete cookies. It works great in Firefox, but in IE the cookie still exists, it's just lost all of its data. I can check to see if the data is there, and ignore the cookie if it isn't, but since I'm looping through my cookies when the page builds, I rather it be completely removed.


document.cookie = name + "=noop; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=" + path;

View 2 Replies View Related

Trouble With .getElementId() In Firefox

Dec 12, 2006

I have a cgi program which outputs a fairly hefty amount of
html/javascript for doing a complex slide show sorta thing in a variety
of areas in the browser. I accomplish this by creating a series of
iframes and populating each iframe which its own copy of the code and a
list of items to display. It previously had it working tickety-boo
with both IE 6 and Firefox. I've had to concentrate on adding new
features to the IE side and am now attempting to get everything working
properly in Firefox.

The issue I'm running into is when I use the form
document.getElementById('some_id').someFunction Firefox often replies
that the object has no properties. I've handcoded some smaller
versions of the my program in straight html and, sure enough, they work
great. So, I'm screwing something up in my main program whereby
Firefox can't see the objects. Code:

View 9 Replies View Related

Page Linking Trouble

Jul 20, 2005

How can I use Javascript to look at variables passed from another page
using the GET method( a website address) and load that website?

View 1 Replies View Related

Trouble With Loops And Arrays In Java

Nov 14, 2000

I've been working on trying to compile this bit of Java code. It's taken from an existing code (with permission) that I know works. The problems started when I added an array. Code:

View 6 Replies View Related

Submit() Trouble In Iframe - Firefox

Nov 5, 2007

I have a hidden "in between" page where I dynamically create a form and
hidden inputs using ASP that should submit to a second page where this data
will be used.

The form is automatically submitted using javascript. This code works in IE
and in Firefox.

The problem I am facing now is that the series of these same pages I am working with are now being used inside an iframe. Since this change, the javascript submit no longer works in Firefox, but does in IE. Code:

View 3 Replies View Related

Trouble With PO BOX Validation Regular Expression

May 6, 2011

Working on a validation API and having trouble with a PO BOX validation Regular expression. I tried adding ? and ?! in front of the regular expression but I want the exact opposite of what is doing. I want any entry besides combination's of po box entries to be allowed.

View 3 Replies View Related

Trouble Escaping Generated Content

Jan 7, 2011

I'm dynamically generating an image tag, and the final slash for self-closing the tag is not coming through, even though the slash is escaped with a backslash. Worse, I think this is screwing up my attempt to select the image in another function. Any ideas what could be causing problems? [code]The image does appear, but I can't reference it later on.While everything works fine if I drop the " img" from the call and let clicking anywhere in the div start the search.Any idea why escaping the slash isn't working?

View 11 Replies View Related

Trouble Changing My Array To Include For/in Structure......

Mar 25, 2007

hey guys i am having trouble changing my array code to include a 'for/ in' structure the code i am trying to change is below:

<script type="text/javascript">
var contents = new Array(3)
contents[k] = new Array(2)

contents[0][0]="Player Name"
contents[0][1]="Player Number"
contents[1][0]="Shay Given"
contents[2][0]="Scott Parker"

function changeContent()
var r=document.getElementById('myTable').rows
for(i=0; i<r.length; i++){
var x = r[i].cells
for(j=0; j<x.length; j++){
x[j].innerHTML = contents[i][j]

the code i am using currently using changes the contents of a table in
my main page, the code for the table is below:

View 2 Replies View Related

JQuery :: ClueTip Focus / Blur Trouble

Oct 22, 2009

I'm working with ClueTip and have run into some oddities.In particular, I want to show ClueTip when a textbox receives focus.The source shows me that I can use activation:'focus' for this and that will result in the cluetip showing on focus and disappearing on blur. Showing the cluetip is working fine, blurring is not.[code]

View 4 Replies View Related

Ibox - Trouble Adding An Onclick Event

Nov 4, 2010

I'm using the ibox javascript library which is very similar to lightbox in functionality. I'm trying to do something seemingly simple but am having difficulty.

My goal: Use ibox to show a dynamic graph based on a clicked link.

When the user clicks the link it will grab data from the current table row, format it, and render it using the flot library. This will all be done in a hidden div. This is easy enough. Then the hidden div will be displayed using ibox.

These are both easy enough tasks individually. What i'm having trouble with is combining them into a single click.

Currently I have it setup like this.

Code "Html:

When a user clicks this link the loadGraph() function never executes. I'm assuming this is because priority is being given to ibox (indicated by the rel attribute). How can I force my onclick event to be executed before the ibox is loaded?

I would even be ok if it was executed after the ibox was loaded, my main goal is to get both actions to occur in a single click.

View 1 Replies View Related

Internet Button On Keyboard Causing Trouble!

Nov 30, 2004

I have an internet key on my keyboard, and I'm sure others do too. When I push it, it opens Internet Explorer to my homepage. If I am already in internet explorer, and the page is focused, and I push the internet button, then it changes the location of the page to my homepage.

I want to prevent it from doing this for my users whom visit my site. I have a popup, and while in that popup, it is likely they push that button, or start internet explorer. Is there anyway to detect this, and either block it, or blur the page before it takes effect in Javascript?

It DOES NOT happen if I push START>Internet Explorer since when I click Start, it blurs the webpage.

View 12 Replies View Related

JQuery :: Multiple Classes Selector Causing Trouble?

Sep 19, 2009

In order to allow users to filter content, I've created a small checkbox list. To each checkbox is attached an ID, and too some divs on the page are attached these id's too (in the class attr that is); one div can be attached to multiple id's, and so have multiple classes.

In order to show or hide my div's I wrote :
function couponsVisibles(){
var coche = $(this).attr("checked");
if (coche) {
var idCoupons = $(this).attr("id");
$(".zoneCoupon , div[class='" +idCoupons+ "']").each(function(){
var coche = $(this).attr("checked");
if (!coche) {
var idCoupons = $(this).attr("id");
$(".zoneCoupon , div[class='" +idCoupons+ "']").each(function(){
It looks like my selector "$(".zoneCoupon , div[class='" +idCoupons+"']")" doesn't work, but I can't figure out why. I've started using the [attribute*=value] selector, but this selector doesn't seem to make a difference beetween class='8 10' and class='8 1'...

View 1 Replies View Related

JQuery :: Trouble Combining Flash's Externalinterface.callback

Feb 1, 2010

I have two swf using AS 2.0 in a webpage. One of them is hidden at the start, but when I rollover on the other one, the hidden one is supposed to show up and the visible one is supposed to hide.However, everytime I rollover it, it says peelOff() is not a function. Although it is a function, since I'm able to control it with any other events such as "click".I could use the callback of a mouseover to call the peelOff() function?

View 1 Replies View Related

Coda Slider Effect Nested Trouble With Navigation?

Aug 31, 2009

I get the navigation disappeared with the nested slider. A workish on line example[URL].. try to click on design and than on the menu below. I don't know which way to turn The script is based on [URL]...

View 1 Replies View Related

Whitespace Trouble In Form Element Names W/javascript

Oct 5, 2001

I am having difficulty using javascript to validate form fields with whitespaces in the element names (ex: First Name, Last Name).

here's a code snippet:
function validate(formObj) {
if (document.form1.Payment Method.checked){
do something here...}

the problem is that javascript won't read the element "Payment Method" unless i mash the name into one word. (i don't want to do that because i later use the element names to provide a printable customer receipt

i tried using the ascii octal number for a whitespace in the above code (...form1.Payment40Method.checked...), but to no avail.

View 2 Replies View Related

Recursive Function With For Loop, For Loop Is Breaking When Calling Itself

Jan 22, 2011

I have been looking at this code for two evenings now, and rewrote it 4 times already. It started out as jQuery code and now it's just concatenating strings together.

What I'm trying to do: Build a menu/outline using unordered lists from a multidimensional array.

What is happening: Inside the buildMenuHTML function, if I call buildMenuHTML, the for loop only happens once (i.e. only for 'i' having a value of '0'.) If I comment out the call to itself, it goes through the for loop all 3 times, but obviously the submenus are not created.

Here is the test object:

test = [
"name" : "Menu 1",
"url" : "menu1.html",
"submenu" : [


'Menu 2' and 'Menu 3' don't show up! I'm sure it's something small that I'm overlooking.

View 2 Replies View Related

Send A Loop Variable (i) To A Function Inside The Loop

Aug 4, 2011

I'm looking to send a loop variable (i) to a function inside the loop, but I can't seem to get it to use the value I want, it keeps making it a reference of i and therefore the function is always called using the last value of i rather than the one it was set with.

So if i have 5 Tabs then Tab 1, when clicked, should call DefaultTabClick(0) and so on rather than always using 4 for any of the tabs.

View 2 Replies View Related

3 Conditional Pulldowns

Jul 20, 2005

Is there anybody who knows were to find a javascript that does the trick
of conditional pulldowns (3).

Here is what i am looking for:
When you select an item from the first pulldown, the second pulldown
gets populated with the children of the item you choose. Then, when you
select an item from the newly populated second pulldown, the third
puldown gets populated.

View 1 Replies View Related

Conditional BeforeUnload

Oct 28, 2003

Essentially, I would like the user to be prompted that application has not been completed on back, close etc. I however do not want the user to be prompted if they have completed the application.

I have a function on submit where I plan to set the flag to true.

I would expect something like the following but it doesnt work for me?

function unloadMess()
mess = "Leaving this page without submitting the application form will clear DOB entries. Do you wish to leave the application form?"
return mess;
function setBunload(on)
window.onbeforeunload = (on) ? unloadMess : true ;

if (flag = "N") // Application form has not been submitted.

Any Ideas?

View 7 Replies View Related

Conditional Regex

Oct 27, 2004

i have the following regex:


this needs to be able to match a string and make the following replacements:
if the string matches without < or >, replace the match with a space, a replacement string, and another space. if < matches also, do not add the left space. if > matches, do not add the right space. if < and > match, do not add the beginning or ending space

Old {} String => Old Replacement String
Old {<} String => OldReplacement String
Old {>} String => Old ReplacementString
Old {<>} String => OldReplacementString

this will have to be done a LOT of times, so efficiency is very important the answer in php is below. can anyone help me figure out how to do it in javascript? PHP Code:

View 4 Replies View Related

Copyrights 2005-15, All rights reserved