E.srcElement And E.target Return The Wrong Element
Aug 16, 2010
In this case the e.srcElement/e.target should return 'home' or 'about', but instead one of the two layers inside 'home' or 'about' will be returned. And these dont even have a onmouseover attribute! The following page is specially made to make it easy to fix the bug if you know how :-)[URL]
View 8 Replies
ADVERTISEMENT
Jan 9, 2006
I am relatively new to js, but I did think I was starting to get the
hang of it. Then this happened...
I have a form with an onsubmit event handler:
<form id="uploadForm" method="post" action="..."
onSubmit="checkDates()">
The event handler does some minor validation, then returns true or
false:
function checkDates(y, m, d) {
if (endDate.getTime() >= startDate.getTime())
return true;
alert("Start date must precede end date");
return false;
}
(The arguments to the function are used when it is called elsewhere,
not as onsubmit.)
I also have a library class which needs to process the form submit, so
it hooks onsubmit like this:
MyClass.setOnSubmit = function(listId) {
var list = document.getElementById(listId);
var form = list.form;
var f = form.onsubmit;
if (typeof f == "function") {
form.oldOnSubmit = f;
form.onsubmit = function(){
var ok = this.oldOnSubmit();
if (ok)
return MyClass.onsubmit(listId);
else
return false;
};
}
else
form.onsubmit = function(){MyClass.onsubmit(listId);};
}
My problem is that the value returned from oldOnSubmit and stored in ok
appears as 'void'. This happens in IE 6 and in FireFox 1.07. Can anyone
explain what's happening?
View 8 Replies
View Related
Jan 14, 2009
I cant figure out why this wont return the highest target. The variable highest_target is placed outside the for loop.
Code:
var highest_target;
var inputs = divs[i].getElementsByTagName('INPUT');
var bounty_target = 'http://apps.facebook.com/mobwars/fight/do.php?';
var target_id = '';
[Code]....
View 1 Replies
View Related
Feb 13, 2011
I'm trying to build a slideshow for wordpress. On a static page everything works as expected.In Wordpress however, the same script*1* behaves differently. The activeSlide is hidden behind the "default anchor image". I think it's because activeSlide gets assigned to li instead of the a -tag. You can see that with Google Chrome. The activeSlide class is advancing, it's just assigned to the wrong element. I'd like to target the link (a) again, so the green box appears in front of the red box.
This is the script
<script type="text/javascript">
$(function() {
$('#slideshow').after('<div id="slide_navi">').cycle({
fx: 'scrollLeft',
speed: 600,
Timeout: 4500,
activePagerClass: 'activeSlide',
pager: '#slide_navi',
pagerAnchorBuilder: function(idx, slide) {
return '<li><a href="#"><img src="images/transparent.png" /></a></li>';
}});
});
</script>
The only difference is the way I get the images. But this shouldn't change the activePagerClass target, right?
View 4 Replies
View Related
Aug 3, 2009
I've been using the following to provide a moving background for the BODY element... but would very much like to apply this to the background inside a specific DIV element (with css id: #banner).
Code:
Any ideas how to modify the position of a specific DIV ?
View 2 Replies
View Related
Sep 15, 2009
I would have wished it under better circumstances. However, I'm having a quite annoying problem. I'm using jQuery UI hide effect and for some reason it messes with the DOM and/or and completely messes up some of my controls.$('#dvucCustomization').hide('fold', {}, 500);Is that the correct way to call the hide effect on a DIV element?I also tried simply:$('#dvucCustomization').hide('fold');and the same result: the JSs I have in the hidden/shown element are not working any more.
View 6 Replies
View Related
Sep 12, 2011
I have a following menu that I'd like to be collapsible.
<ul id="#menu-sidebar">
<li>Menu item 1
<ul><li>Menu item 1.1</li>
<ul></li>
<li>Menu item 2
<ul><li>Menu item 2.1</li>
</ul></li></ul>
This collapses and expands them, but of course all at same time.
$('#menu-sidebarli ul').hide();
$("#menu-sidebarli").click(function(){
$("#menu-sidebarli").toggle();
$(this).toggleClass("active");
});
I've been trying to experiment with the .next() trying to get the next ul li ul element but with little luck.
$('#menu-sidebar li ul').hide();
$("#menu-sidebar li").click(function(){
$("#menu-sidebar ul li").next().toggle();
$(this).toggleClass("active");
View 3 Replies
View Related
Feb 25, 2011
I have a html page that contains a number of <H2> tags. I need to find this specific <H2> tag:
<h2>Submit Your Survey</h2>
...and then replace the text 'Submit Your Survey' with something else (such as 'Click the button below').How could I do this?
View 2 Replies
View Related
Jun 1, 2010
consider the following code;
$("#content").click(function(event)
{
if($(event.target).is('a'))
{
$(this).//do something
}
}
I'm binding a click event to a div so that I can see whether is was the div or some element inside the div that has been clicked. When the if() in my code evaluates to true $(this) is still equal to $("#content") whereas I'd like to have the clicked anchor as matched element. How would I do this?
View 2 Replies
View Related
Aug 18, 2011
I want to call me function on document ready and target elements will generate by AJAX at run time. Is there any function for that?
I'm familiar about live() and delegate() but main problem is that, We can use it with any event only :(
We can call delegate() or live() with events like click, mouseOver, mouseLeave, focus etc. There is not any way to call it on document ready :(
Is there any other function we can use to do that without any event?
View 1 Replies
View Related
Aug 4, 2009
I would like to return the style left value from an element. Is this possible with javascript?
<script type="text/javascript">
function moveleft() a test function
{
document.getElementById("first").style.left = "50px";
if I try alert(document.getElementById("first").style.left);
[Code]...
View 1 Replies
View Related
Jan 27, 2006
Can anyone explain why this just alerts [object]. I'm trying to change the background of a tr when it's clicked on, I only added in the alerts to see why it wasn't working.
<tr class="a"
function sel() {
var x = event.srcElement;
alert(x);
}
Is there a better method?
View 1 Replies
View Related
Aug 20, 2010
i've seen this code at work which i do not get.
var Key = {
'Number1': 49, 'Number2': 50, 'Number3': 51, 'Number4': 52, 'Number5': 53, 'Number6': 54, 'Number7': 55,
'Number8': 56, 'Number9': 57, 'Number0': 48,
};
I need to return a var element from Key based what a var containing a string contains e.g
var string = "1"; an example
return Key.Number1
How would I do this using a for loop and not having multiple if statements
View 5 Replies
View Related
Nov 20, 2011
I'm using the jquery topZIndex plugin in my application. It's working great. Now I have a situation though, where I would like to return the element with the highest z-index on the page. The plugin has a function that will return the highest z-index, but it's a value, not an object.
View 2 Replies
View Related
Jul 23, 2005
I have this IE specific bit of code for finding the originating node:
var obj=window.event.srcElement;
How do I do that cross browser (Opera, NS, Safari...)? Is there a standard
DOM method?
I seem to recall NS worked something like this:
onmousedown=handleThat;
function handleThat(e){
e.target;
// but then I'd have to take the parent to get the same node as IE
}
Event handling makes my head spin!
View 5 Replies
View Related
Apr 6, 2011
Mozilla-equivalent of the following line of code:
document.getElementById('editorContent').contentWindow.event.srcElement.href
The purpose of this line is to get the "href" value of a link when clicked on inside a content-editable iframe.I have the function working perfectly in IE, but not having much luck with Mozilla browsers.
View 9 Replies
View Related
May 24, 2011
I am fairly decent with JQuery, but there is always more to learn of course! Consider the following structure.
<div class="container">
<div id="label1">
<div class="label1_1">
[code]....
View 1 Replies
View Related
Nov 13, 2005
This is my object elobj.
elobj=el.document.frames[fIDx].document.body
elobj.onresizeend=doElResizeEnd
When some one resize image element the doElResizeEnd function
start's .But I get "Require object" error from "var el= event.srcElement;"
function doElResizeEnd()
{
var el= event.srcElement;
if( el.type=='image')
{
alert(el.name)
alert(""+el.width)
alert(""+el.height)
}
alert("doElResizeEnd");
}
View 6 Replies
View Related
Jun 24, 2010
//This is my html code
<INPUT TYPE="Button" CLASS="Button" onClick="delRow()" VALUE="Delete Row">
//this is javascript function for deleting a row
function delRow()[code].....
View 8 Replies
View Related
Mar 23, 2010
When you click on the "details" link, a modal window pops up with the job info.This works in IE, but nowhere else. My js skills are shaky, at best, but I did figure out that event.srcElement is IE only and that there are better, modern methods of achieving this.Problem is, I don't know how to implement them in this instance.How can I rewrite this so the modal window functions correctly in IE, FF, etc?Here's the code:
Code:
function displayDetails(num,ctrl)
{
for(var i=0; i<details.length; i++)[code]...
View 5 Replies
View Related
Apr 8, 2010
I am using GreaseMonkey to load jQuery 1.3.2 (there is a bug with the latest version of jquery and GM) and jQuery UI 1.8.0.I am using jQuery via GM to manipulate the GUI of a content management system. This CMS uses its own JS library to dynamically add stuff to the dom.
Question:How can I target a dom element that was added to the dom via this other JS lib?In other words, the CMS will add a div to the dom, and I am not sure how to tell jquery to wait for these elements to "be there" before applying the jquery goodness. Specifically, I would like to do this:
$(function() {
$('#zen1227').resizable();
});
But "#zen1227" does not "appear" until later via this other JS library.
View 4 Replies
View Related
May 19, 2011
i want to submit form data from the popup window, close the popup, and load in the main window. problem is, it always opens a new 'tab'. i'm using google chrome, i didn't think to try this in
in the <head> of the 'main' window:
<script language='javascript' type='text/javascript'>
window.name='main';
</script>
[Code]....
View 4 Replies
View Related
Mar 24, 2011
I am using the following javascript on the target page to open it as top location from within an iframe, which is working ok.
<script type="text/javascript">
if(self!=top) {
top.location.href=location.href
}
</script>
However my problem occurs when the user uses the browsers back arrow to return to the previous page, the script executes again returning them once more to the page they have come from. Is anyone aware of a work around to this problem as it would seem there isn't one? perhaps even a better solution for opening the target page from the iframe as top location. This is really causing confusion for users, and I really need to get the issue fixed.
View 2 Replies
View Related
Jun 3, 2010
All is on the title, sorry for my english, i'm french :) I have an html page with style
<style>
#mydiv {
margin-left:auto;
margin-right:auto;
width:250px;
}
</style>
with jquery, i try to get the margin-left ($('#mydiv').css('margin-left'), but the function return 0px, unable to retrieve the good value (auto) anyone has idea to retrieve the value "auto" when margin-left is "auto" ?
View 1 Replies
View Related
Feb 5, 2007
If I am using srcElement (or "target" for non-IE models) to return
various properties of an object I have clicked on, can I access for
"label for" value in any way? I'm thinking, for example, of an input
text box like this:
<label for="fred">Username:</label>
<input type="text" name="hello" id="hello1" size="10">
Now, once a function has:
var obj=event.srcElement || event.target;
.... at the top, I should be able to access obj.name and get "hello"
etc, but how can I access the label value of "fred"? I did try
obj.label but it didn't work...
View 4 Replies
View Related
Jul 23, 2005
if I put the line:
var T = new Array(-1);
anywhere in my script, it stops working. e.g
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
var T = new Array(-1);
document.open();
document.write('hahahah');
-->
</SCRIPT>
doesn't produce any output. If I change
var T = new Array(-1);
into
var T = new Array(1);
or
var T = new Array(-1,-1);
everything works fine again.
Same results in Mozilla 1.7.2 as in IE 6.
Is that a bug in both their javascript interpreters or can anybody
give me a good explanation of why that is?
View 4 Replies
View Related