I have a script for a radio player that I'm working on using Windows Media Player. Before I was using the safe WMP 6.4 object model but because of feature requests I've had to include support for more recent WMPs.
I have a javascript class that wraps the versions and depending on which version is being used it calls different methods. I was wondering if there was a way to assign the events of WMP to functions in javascript, but without using <script for=WMP event=blah> type tags. Code:
Geeting a JS error from IE 6 only in this method: handle: function( event ) { var all, handlers, namespaces, namespace, events;
[Code]...
On the last line of the code snippet above. It appears to me that IE6 doesn't like the fact that the events object is undefined. To trigger this error we are doing a simple blur binding to an input box. ex:
$(field).bind('blur', function(){onfocusout(this);}); It appears IE 6 stops executing JS after the error (imagine that). Is this an issue in jQuery core or BTW I know MS has dropped IE 6 support but we still have customers.
I have found what seems to be a bug. When you have a keydown, keypress and keyup event handler on a text box in Opera, it won't call the keyup handler when you hit the down arrow key. Every other key, including up arrow, seems to work fine.
To make sure it wasn't just me, I tried this in Opera with one of Mike's demos:
If you use the arrow keys while any object other than a textbox has focus, keydown, keypress and keyup show 40 and 38 for down and up arrow, respectively. However, if you focus on one of the textboxes, 40 only shows up for keydown and keypress, not keyup. 38, however, continues to show up for all events.
If you've caught a mouse event (say, onmousemove) and you're currently in the process of handling that event, is it possible for that, or another, mouse event handler to get hit again, at the same time that you're handling the previous event? Or is it guaranteed that no additional events will actually call any of your event handlers until your code returns from handling the prior event? That is, is it strictly sequential processing, or can they occur simultaneously?
I'm having a hard time figuring out how to refer to an object while inside a jquery event function. In the following example, "this" at first is referenced as #myDiv. But inside the draggable event, "this" refers to something else. I am not sure what it is referring to, but how do I reference the original object (Human) from within this event?
var Person = new Human("#myDiv", "my data"); function Human(element, myName) { this.name = myName;
I am using following JavaScript code to add click event on anchor tags with attribute rel="gcode"
Now I need a script to highlight all anchor tags which have an click event attached with them.
Is it possible using JavaScript to get a list of events attached with an object? Also I will need to check the code used in every event. (It is something like an Quality Assurance or Debugging code.)
Code JavaScript: function gLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++) {
I want to use a select object in asp and have the user pick something from this select and have javascript open a window fired by an event. Once the new window is open it displays another select with data based on what was picked in the first window. Once a choice is made in the second window, it allow users to click a submit button and pass back the chosen value to the calling window. Code:
It looks like when I do $("object").bind("<mouse-event>") the event isn't actually being bound to the element in Chrome and Firefox (not sure about IE). Using $("object").each(function()
I'm trying to convert some Procedural code to be more Object Oriented and I'm stuck...
The page is really simple:
It's just a big picture w/ a caption under it, and a few thumbnail pics off to the side, that when clicked, replace the big picture as well as swap out the caption for a new one.
In the code (external JS file):
I've got 2 arrays:
One that holds the thumbnail image file URLs, and the other that holds the captions.
And a function:
I've created an object prototype that I can instantiate in order to:
1.) create the event: do the actual swapping of the thumbnail, and the changing of the caption.
2.) and attach that event to the thumbnail's link onclick event handler.
The code below is the closest I've come to making it work. The problem is that when I click any of the thumbnail links it only executes the last event instead of the one that corresponds to the link that was just clicked. Hopefully someone can take a look at my code and let me know what I'm doing wrong.
Simplified version of the code:
The x,y,z variable assignments are only in the window.onload function for the sake of clarity, but the event object instantiation block has to be in there for anything to work at all.
I know that the event0,event1,event2 objects work, and are attached to the onclick handler because they will swap the last thumbnail and caption when I click any of the thumbnail links. Of course that's the problem now... any click only activates the last event. It's like it attached the last event to all the onclick event handlers.
In fact, if I only create the event0 object, it works like it's supposed to... but when I create the event1 object, it does what it's supposed to and it takes over for event0. Creating event2 makes it take over for all of them. Each subsequent event# object seems to attach its own addy[ ] and caption[ ] to each previous x[ ] link.
I have the following function which gets invoked for mousemove and it works fine for all elements except for elements which are disabled, I am getting "Object doesn't support this property or method" error.
function ddMouseMove(ev){ ev = ev || window.event; var target = ev.target || ev.srcElement; if(target.getAttribute('partOf')) { //error on this line for disabled elements ..... } var dragObj = target.getAttribute('DragObj'); ..... } document.onmousemove = ddMouseMove; document.onmousedown = mouseDown; document.onmouseup = mouseUp;
How do I make sure 'ddMouseMove' and other functions above are called only on active elements when mouse event occurs (In other words how to stop mouse events on disabled elements) ? Or is there any alternative solution ?
Is there a way to create a DOM document object to hold the contents of an external html?
I have two pages:
content.html contains some content. index.html would like to access the contents of a particular <div> with an id of "important" within content.html.
how would I do this? I know I can hack around and load the content.html in an iframe embedded in index.html. Then, I can make the iframe not visible....
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.
My site has a widget that runs by calling an external script on a server outside my control. Normally this runs within a div as the page loads and the widget is displayed within the div.
What I am trying to do is call the script AFTER the page loads rather than while it loads. To do this, I am adding the script to the DOM (in the div I want, not to the head) on window.onload. An alert shows that the script is being created in the div.
The problem is that the script does not appear to fire in IE6 and IE7. In Firefox it runs, but rather than adding the widget to the div, it creates a new page (everything else on the page is lost).
I have made a test page to show the problem, as well as another page showing how the widget normally loads when the called while the page is loading. Code:
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.
//-----10% Off Coupon----- if (coupon=="N110"){ form.PRICE.value=-(moneyFormat(fTotal * .10)-1); form.ID_NUM.value="N110"; form.NAME.value=" Craft Month Promo 10% Off"; location.href=location.href; return true; }
I want to replace the .10 with an external peice of data, so users can change the amount with having to open the script. Sorta like those early marquees' where the marquee text was inserted from a text file.
We have some date fields in our HTML forms in various places. In the accounts package we use, there is some pretty nifty date handling.
It has a standardised date format of dd/mm/yyyy and if you enter e.g.
3-12 it will switch it to 3/12/2005
Same applies for e.g. 3:12 etc
Anyone know of some javascript which will do this for our HTML form fields? Our target format is actually dd-mon-yyyy and it would make it really nice for users if the system could accept a variety of input formats and then switch it to a date to our specification. Any suggestions?
I have few textfields and dropdowns in my jsp, form is submitted on clicking an image link.
In case there is an error for instance some text field is left empty, then message is displayed below respective fields ( using spans, inner html). The message is displayed onblur event of the field. So if there was an error then message is displayed, now if the user corrects the error and clicks the link then first the message disaapears ,which is desired ,but he has to click again to submit the form. please suggest a way to handle this. So that user doesn't have to click the link twice to submit the form.I tried having onmousedown and onfocus events on image , but then sometimes the form was submitted twice which gave backend errors.
This works but the user needs to hit the go button, if they just hit return the text field is emptied, I would like if the user hits ENTER, the search begins.
I believe I can add something similar as
if (window.event.keyCode == 13)
But I am not sure how to incorporate it in the form?
I am struggling to find definitive information on how IE 5.5, 6 and 7 handle character input (I am happy with the display of text).
I have two main questions:
1. Does IE automaticall convert text input in HTML forms from the native character set (e.g. SJIS, 8859-1 etc) to UTF-8 prior to sending the input back to the server?
2. Does IE Javascript do the same? So if I write a Javascript function that compares a UTF-8 string to a string that a user has inputted into a text box, will IE convert the user's string into UTF-8 before doing the comparison?
I think that the answer to question 1 is probably "YES", but I cannot find any information on question 2!