GetElement...
Jan 14, 2004
we have an onMouseout event within in the body tag. The document itself uses several div tags. Now, both, the body and the div tags are triggering this event. However, we only wanna deal with the event, triggered by the body element. So this is the question: how do we check, which element triggered the event? Using an ID in the body tag?
View 1 Replies
Apr 5, 2005
function getElement(aID){
var rv = (document.getElementById) ? document.getElementById(aID) :
document.all[aID];
return rv;
}
This script should return the element in both IE and NS without problems.
Use Example:
var myElement = getElement('someE');
Notice how I can now make one single call for both IE and NS?
View 1 Replies
View Related
Mar 22, 2010
I have the following javascript code:
elms=document.getElementById('friends').getElementsByTagName('li');
for(var fid in elms){
if(typeof elms[fid] === 'object'){
fs.click(elms[fid]);}
}
Which grabs all "li" tags with the ID "friends" , and then goes through and clicks all of those elements.How would I go about having it to where it only clicks up to 200 elements, and not all of them.
View 2 Replies
View Related
Aug 24, 2010
This code came from [URL]. I tested it on ff, opera and google chrome they worked. But on IE8 it did not work. My active scripting on IE8 is enable.
<html><body>
<h1 id="header">Old Header</h1>
<script type="text/javascript">
document.getElementById("header").innerHTML="New Header";
</script>
<p>"Old Header" was changed to "New Header"</p>
</body></html>
<html><head>
<script type="text/javascript">
function getElements(){
var peter=document.getElementsByTagName("input");
alert(x.length);
}
</script></head><body>
<input type="text" size="20" /><br />
<input type="text" size="20" /><br />
<input type="text" size="20" /><br /><br />
<input type="button" onclick="getElements()" value="How many input elements?" />
</body></html>
View 6 Replies
View Related
Mar 29, 2009
I've created a simple code example shown below, the problem is when I run it on IE it returns a blank value, while FF return the selected value. I've built a website using this idea, and the problem is I didn't try on IE until it's too late. This is the code, run it in FF it will work, run it in IE the message is blank !!
Code:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head><body>
<script type="text/javascript">
function showvalue() {
alert(document.getElementById("region").selectedIndex.toString);
}
</script>
<select id ="region" onclick="javascript:showvalue()">
<option>test 1</option>
<option>test 2</option>
</select></body></html>
View 1 Replies
View Related
Jan 18, 2009
What I am doing wrong this worked with tables but not text boxes. Here is what i am trying to do. I have a bunch of text boxes on a part of a page and trying to get them to copy into two index size cards with text boxes on another part of the page then just print out the card only. Here is what I have so far (copy from the red to the blue and green).
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]">
<html xmlns="[URL]">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="JavaScript" type="text/javascript">
function copyValue(el) {
document.getElementById('copy_' + el.id).innerHTML = el.value;
document.getElementById('copy2_' + el.id).innerHTML = el.value;
}
</script> .....
View 1 Replies
View Related
Sep 26, 2009
Here is a clip of code from a script project im working on. Now my document.getElementsByTagName is returning a "undefined" value.
<a href="[URL]" style="text-decoration: none; color: #EDDBAF; font-size: 16px;">
<center style="margin-left: 10px; margin-right: 10px;">
<font style="color: #EDDBAF; font-size: 16px;" id="title"></font>
</center></a>
<li id="name"><a http="[URL]" style="color: blue;">John Doe</a></li>
<script type="text/javascript">
var pname = document.getElementById('name').getElementsByTagName('a');
Now if I remove the ".getElementsByTagName('a')" it will actually work, but it also includes the <a> tag thats within the <li> tag, which I don't want.
document.getElementById('title').innerHTML=pname.innerHTML;
</script>
View 4 Replies
View Related
Sep 12, 2005
im having trouble getting through all of this if statement block in firefox. the internet explorer code works. here is the firefox version first:
function disbleTextButton(_varButtonId, _varNewText) {
if(browserType() == "Netscape"){
for (i = 0; i < document.updateForm.getElementsByTagName('*').length; i++) {
obj = document.updateForm.elements[i];
if (obj.tagName == "INPUT") {
if (obj.type == "image") {
if (obj.name == _varButtonId) {
alert(obj.src);
break;
} } } }
}
i want to get to the alert but cant. the IE explorer code works perfectly. here it is.
for (i = 0; i < document.updateForm.all.length; i++) {
obj = document.updateForm.all[i];
if (obj.tagName == "INPUT") {
if (obj.type == "image") {
if (obj.name == _varButtonId) {
alert(obj.src);
break;
} } }}
View 4 Replies
View Related