I had a rethink about my problem discussed in this [URL] thread, where the function won't run properly a second time if the page hasn't been reloaded. That one appears not to have a solution, and I was thinking that a reasonable plan B is the following:
a) test if the function has already been run since the page was loaded
b) if not, run the function
c) if it has, reload the page with the onClick, then run the function automatically on reloading.
the problem I envisage is will the page "remember" to run the function once it has been reloaded?Of course, it would be simpler to do it running the function automatically once the page loads, then just reloading if the test comes back that the function has been run already, but that wouldn't work for the first time you visit the page - it would start running straight away, whereas I want it to wait for that first click. Here's the page [URL] I'm working on, if you want to have a look.
So I have a function, and in that function there are two paramaters: index and newLocation. Each of these parameters can initially either be an integer or a string: The string can only be the values of "first" or "last". I can do a long set of code for both parameters, but I was wondering if there was a way to iterate through the parameters to make the code more compact and reusable.
if(parseInt(index, 10) == "NaN") { if(index == "first") { //The first index of the array index = 0;
I have the below function and I keep getting the error Lid is not defined.
<script type="text/javascript"> function loadTips(file,ID,File,id){ alert(file); alert(ID);
[Code]....
So my alert Lid comes up with txtHintLees, so it is working up until the alert. Which leads me to believe that maybe it doesn't like being wrapped in "", without "" though firebug halts the process. I tried wrapping it in {} e.g. {loadXMLDocRefresh(File,id)} but that wasn't liked either. I'll stop my list of things I tried that don't work now.
Is there any way to test for the presence of the Adobe Acrobat plug-in in Internet Explorer? It's doable in Netscape but so far I cannot get it to work in MSIE.
I'm trying to get JSUnit to work - I've tried everything I can think of, but I can't get the simplest of tests working - example 1 of the jsunit homepage - Both on my server and locally, nothing happens after clicking run - or if I'm lucky, a window pops up, blank, other than the heading "Tracing - JSUnit".
I was putting some javascript in a form and doing my usual testing and swearing when the javascript did not run without an error message of any type and reverting the code back until it did run and adding code til it didn't.
Then it hit me - isn't there a better way - doesn't someone have a program or utility that will help debug Javascript ???
As I'm doing Javascript it is much harder to decode than the 30 year-old Fortran programs - they typically gave a line number and variable name that was missing.
When I did Basic before Visual Basic, the editor identified errors in real time as we typed. What is available for Javascript?
If I have to test my code on different Netscape versions, can I download and run those versions on the same computer or will it create conflicts? And if I had to test only one version which one should it be - which one has the most common elements to all the versions?
I am trying to check if my new window is open and if it is change the url. This works until I use the x in the corner to close the window. At that point i get an error when i try to open the window again. I believe that it is because newWindow is still active. How do I close newWindow when it is unloaded or closed by the x. If this is truely the problem.
determine what the first letter of a selector is? For example, if the very first letter of a paragraph is a quote (or a ‘ , or a “ , etc) I would like to apply a negative text- indent to the found paragraph so as to replicate "hanging quotes" that are commonplace in the print world. The code I've come up with is: $("p:contains(“), h1:contains(“), h2:contains(“)").css({'text- indent':'-0.3em'}); but this grabs any p or h1 or h2 that *contains* an opening curly quote; not what I'm looking for. I need it to select paragraphs that *start* with the opening curly quote. Incidentally, I could not get this to work when I was searching for $ ("p:contains(“)... but it worked when I entered an actual opening curly quote in the search (as above top). I tried both single and double escapes too.
does anyone know how I can test, in javascript, which of several buttons was pressed when submitting a form? Currently, I use the onSubmit event handler to call a form validator function, and it is in that function which I would like to test which submit button was pressed. Anyone know?
Is there any way to test if there is overflow in a text area (i.e. a scrollbar is displayed)? This is a read only field so I could change the textarea to a div if necessary.
Is there any way to detect through Javascript whether a browser supports a particular property of CSS? I am experimenting around with CSS3 and I would like to be able to detect whether the browser understands what to do with a particular setting, as in "elementRef.style.newCSS3_property = '3px' " I have heard, although I do not know if its true, that there is some way to access whether the browser knows what such a declaration means.
Code: <script language="javascript"> <!-- // Max number of items to show/hide
[Code].....
Which is designed to hide all but one of a group of DIVs with consecutive IDs in the form "listings_stations_<number>". The problem is, I won't know how many of these DIVS there will be. I know a maximum possible number though.
The script as-is works, but obviously throws up errors trying to get handles to non-existent elements/objects. How can I check an element exists before getting and setting style properties for it? I'd like a solution that works for all three browser-types the script currently works with.
I'm trying to check for this bug with the following script and it *seems* to work. In IE it reports "bubbling" and in Firefox "not bubbling" but I really have no direct way to confirm the Firefox results until the bubbling bug is fixed.
Basically the test script assigns an onscroll event handler to a textarea and then scrolls the textarea down then back up, checking to see if a the event handler works (assigns the "bubbling" variable a "true").
I had to code things with a few settimeouts otherwise Firefox, unlike IE, wouldn't display the down then back up scrolling of the textarea. Which may have been a problem.
Lacking a "debugged" Firefox browser, is there some further (indirect?) tests and/or rational that would support or discredit this script as a valid onscroll event check? ....
So firstly this is likely not in the right place at all, as it's a bit OT but I figured it's the best place to ask. I have to document 4 different tests to my code; what structure should I take when doing this?
I was thinking:
* State the aim of the test
* State the inputs, and what I believe the output should be.
* State the actual output, and whether this positively or negatively affect my code.
I'm working on a script that calls my php file, checks the db and returns text. If the returned text="bad" then i want the var "bad" to be set to 1. at the bottom of my script, if anything has tripped bad=1 then it returns false and the form doesn't submit...everything works great except for this one piece so i was wondering if you guys might offer me some insight
Does anyone know how you can test if an applet's method exists before you try and call it?
for example, if you don't have a JRE installed on your computer and try and access an applet method it shoots out a javascript error at you. I want to be able to test if the applet is operational basically before I try and use any of its methods.
I am trying to check for an element(theLink), in a page, but in my code below, testing for null is raising an error. I have tried both codes below and both give the same error, that this.iFrame.contentDocument.getElementById('theLink').childNodes[0].href is null.
I have a form with several types of checkboxes, and I'm trying to check all but one of them to determine if any of those have been checked. I do not want to check 'all', but I want to see if any of the 'check_' or 'check2_' checkboxes have been checked. There are a variable number of checkboxes, so this is just an example with two of each. Set 1 and Set 2 will always have the same number of checkboxes as each other, though.
I'm testing my webpage in IE8. In firefox it looks and runs greag, but in IE 8, one issue I'm having is this: I have a button that opens a popup window. Works fine in Firefox, but I get 'invalid argument' error in IE8 and the window does not open. I've enabled at a whim some scripting things in the Internet Options.
Here's the code. The "invalid argument" occurs on the window.open call.
In addition, is there any way to have that tile I've given it, "my Site..." appear in the window header? Right now it's not appearing at all in either browser.