I have to make an application that works on pc and apple mac. Therefore I am investigating if it's possible to use html/javascript. The database has 10000 records and is sequentially searched. This may take 20 seconds or so. I want the user to be able to quit the search and also I want the outputscreen to be updated immediately when a hit is found and not wait until the complete search is finished.
The problem is that the click-event of the 'Cancel-button' is processed after the search is finished. Is there something like application.processmessages (similar to Delphi) so all pending events are processed?
I want to process a form with java script to check values of fields, etc and then have it format that dooment nicely for it's submission. in the book that I have that briefly touches on javascript, it says that newline characters(/r, /n) vary depending on the OS. Is this true? Is there any easy way to get around this without asking what OS they are running?
I wish to carry out standard form validation (i.e. is it a date?, is there a value in the field, is it a number) using the onBlur event rather than the onSubmit event. This (of course) leads to problems when cancelling an edit as leaving a field to press the cancel button will trigger the onBlur event and therefore the field validation. Is there any way to know the destination field / button that caused the onBlur event? In Ingres ABF/W4GL (mid eighties language of similar functionality to javascript) there was an available attribute called the targetfield so the code could run...
onBlur myfield = { if (targetfield != CancelButton) { carry out validation } }
Is there something similar in javascript or will I have to program round the houses i.e. onBlur records which validation to run and onFocus runs the validation (unless it's a cancel button)?
Is it possible to use JavaScript to apply different actions to a form depending on a value within the form (eg sending form data to different cgi scripts depending which radio button is checked)?
function NewWindow(){ window.open('sendmail.php', 'newWin', 'scrollbars=no, toolbar=no, width=200, height=200'); }
two problems:
1. the form values are not getting passed over to sendmail.php. 2. after the popup window pops up and loads sendmail.php, the original page, emailform.htm, changes to an error page.
so, what do i need to do to get the form values to be passed, and how do i keep the original page either from changing at all, or, if thats not possible, get it to simply reload itself.
1. Get a piece of HTML from a db 2. Display it on my page with a requirement - clicking on any links in that HTML should not take me away from the page.
This does not only include links which are formed by <a>nchor tags, but also other ways of doing it, like, <span onClick='location.href="http://someurl"'> Blah blah.. </span>
In other words, all the events that can be raised by this piece of html should be blocked.
Setting all the 'onClick's and 'href's to "#" or blank string is probably a good idea to start with, but the list of all such possible causes for an event to be raised, may not be very straightforward to compile.
I was wondering if there could be any way to nullify/block the events that can be raised by such a piece of HTML.
I have been trying to do the following. Using JS I want to create an input element (text box) and attach a event listener. I have done in in two different ways. The first is using xml elements directly (as in e4x) and the second using the dom method createElement (which is much clunkier to write). I'd prefer the former. I've included a stripped down example below.
It appears that when creating an input element using the line:
var inputBox = <input type="text" size="30" />
that it does not have the same properties as when it is created with:
var inputBox2 = document.createElement("input");
because when an event listener is attached using addEventListener, an error is generated on the first, but not the second.
My thoughts on this are either 1. The namespace for the input element is not correct and whether input can have a listener attached. However, my guess is that it would not show up in the first div box. Code:
when is bind some jquery events to, for example, <p id="test">. and later i remove this HTML with jquery should i unbind all events first or are they unbinded with removing the html?
I'm using this script to allow people to populate form fields just by hitting the words from a list that most appeal to them. The idea is that on clicking a word the field is filled in and then "focus" is moved to the next one. I say "focus" because it's not actual focus, but "virtual focus" held in a js variable. Code:
I'm using some click events on normal <a> tags. When I rewrite the links within a html() method call, the click events no longer work. I've set up a very simple example here:When the page is loaded, clicking either of the 'link 2' links displays the correct information.When 'link 1' is then clicked, the main information is redisplayed. However, now, the 'link 2' link in the main paragraph doesn't work, although the 'link 2' link in the menu does.
I have been trying to use jquery function .html() but I noticed that it clears all events that are attached to the selectors. Is there a way around this issue? I want to change the content and keep the events.
I am aware of live and delegate functions but I am making changes to an external page so I do not have control over attaching events or knowing what they are at the first place.
I have a problem with jQuery appending new text to a div - but then not firing events attached to the inserted text.Let me explain. I have a div that contains a number of divs - the div has a link and a hidden form. Clicking on the link fires a slideToggle event which reveals the form.When you submit the form AJAX handles it and jQuery builds another div with the correct link and the correct form which it sticks on the end of the list. That all works fine and dandy.What I want to be able to do is to click on the newly-added link and have it behave in the same way as the other elements that were on the page when it was built. However, nothing happens when you click on it. Zip. Nadda. Rien du tout.Usually I have found a way round the problem - but I am slightly stuck on my current project. Apart from forcing a page reload, is there any way to get the browser to see the newly inserted link and apply the jQuery action to it?
I've used to an AJAX call to load a HTML table into div. This is working successfully. I know want to use a click event on buttons located within the inserted table.
The click event is triggering on buttons outside the inserted table but not on the buttons within the table.
Do I need to call some sort of refresh function to so that jQuery is able to pick up these events?
I'm working on some code and am running into brick walls. I'm trying to write out Javascript with Javascript and I've read the clj Meta FAQ and didn't see the answer, read many similar posts (with no luck though), and searched through the IRT.ORG Faqs (www.irt.org/script/script.htm).
The Javascript is designed to open an popup window and then inside that window call another script which will resize that window. There may be another way around this but the reason I tried this approach initially was that I wanted to call the onload handler in the popup window to resize the image only after the image had completely loaded. I've had some code in the primary Javascript file (showimage.js) before that works if the image has been cached but on the first load, it doesn't resize properly which tells me it is probably because it is trying to resize the window based on the image size but it isn't completely known at that point. So I removed that code and tried placing the resizing code in the second Javascript file (resizewindow.js). BTW I've tried other code to open a popup image and automatically size it ie Q1443 at irt.org but that doesn't do exactly what we need.
Even if there is another way to do this with one file, I still want to figure out why this isn't working in case I run into it in the future.
I thought what I would need to do to use document.writeln to write Javascript would be to escape any special characters and to break apart the script tag ie
document.writeln('</SCRIPT>');
would become
document.writeln('</SCR' + 'IPT>');
I have a HTML page and 2 Javascript files. All files are in the same directory and have permissions set correctly.
Here are the 3 files (keep in mind wordwrap has jacked up the formatting):
index.html ---------- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test</title> <SCRIPT type="text/javascript" LANGUAGE="JavaScript1.1" SRC="showimage.js"> </SCRIPT> </head>
<body> Click the house<BR> <A ONCLICK="newWindow1('house1.jpg','Nice House')"><IMG SRC="house1thumb.jpg"></A> </body> </html>
showimage.js ------------ function newWindow1(pic,sitename) {
resizewindow.js --------------- function resizewindow() { // Do resizing here. // Right now this isn't being executed alert("resizing window"); }
Can anyone provide some pointers as to why this javascript is failing? I'm using IE6 on Win2k and when I click on the image to open the popup window, it does open the window but it is white with no content and the system immediately goes from about 4% CPU usage to 100% and consistently stays there until I kill that window with the task manager.
I am trying to "ajaxify" my site. Now I have one problem:
$("#posts").children().remove(); $("#tag-sidebar").children().remove(); $.each(data.Tags_Sidebar, function (indexInArray, valueOfElement) { var insert = $("<li>");
[Code]......
Now when I click one of those links (href1, href2, href3) generated, the click event won't execute! What's the problem? Also, is it right that I have to transfer the valueOfElement over, like I did? What does stopEventPropagation do? Prevent the href from being navigated to? That's what I am trying to do.
I have just started my adventure with jQuery. I wrote a post on a forum and a men wrote me:"Don't mix javascript with the html of the view as in your <body onLoad="load()">, but put it in a different javascript file thatyou include. In the JQuery tutorial there are example of how to attach events to DOM elements without "touching" the html. "I know how to put my javaScript code to the a ****.js file but I don't can not find any information how to do:attach events to DOM elements without "touching" the html. I was looking for a tutorial here but I couldn't find
I would like to use a .css specification, to allow me to stop hard-coding that location in all my files. I can't seem to find the correct .css incantation for this.
I have a series of images with an animation bound to mouseover and mouseleave events, and I'm trying to get my head around adding a click event that would prevent the mouseleave animation from occurring only for the image that was clicked, preserving everything else as is (until another image is clicked). I've discovered .stop() and I think I'm getting close, but some part of the logic is still escaping me.
I'm loading an XML file which has a processing instruction (<xsl-stylesheet href="..."/>). I need a cross-browser solution which will load the XML file and have it's XSL PI run and translate the XML to genereate the desired output.