|
-
Mar 26th, 2002, 09:31 PM
#1
Thread Starter
Member
Can I access the data value of the object tag via javascript?
the subject says it all 
thanks in advance,
Michael
-
Mar 27th, 2002, 11:50 AM
#2
Frenzied Member
Yes you can, but what do you mean by "object" tag?
I may be thinking of DOM3 (which isn't standard, yet), but you can access the value of anything with getElementByID, getAttribute, getChild, and stuff like that.
Good places to start is post and example of what you are trying to do, or check out developer.netscape.com, or www.w3c.org.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Mar 27th, 2002, 12:06 PM
#3
Thread Starter
Member
Originally posted by CiberTHuG
Yes you can, but what do you mean by "object" tag?
what i mean by the object tag is like this
Code:
<OBJECT ID="CantFindThisElement" DATA="blah.html" TYPE="text/html" WIDTH=300 HEIGHT=300>
</OBJECT>
I have been trying, and you're probably going to yell at me...
Code:
document.all.CantFindThisElement.data.value
and variants of that but havent found anything that will work.
Thanks
Michael
-
Mar 27th, 2002, 12:23 PM
#4
Black Cat
This works for IE6 and Mozilla 0.9.9:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled</title>
<script type="text/javascript">
function testf() {
var vo = document.getElementById("CantFindThisElement");
alert(vo.data);
vo.data = "http://www.google.com/";
alert(vo.data);
}
</script>
</head>
<body>
<OBJECT ID="CantFindThisElement" DATA="blah.html" TYPE="text/html" WIDTH=300 HEIGHT=300>
</OBJECT>
<span onclick="testf();">CLICK</span>
</body>
</html>
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Mar 27th, 2002, 12:25 PM
#5
Thread Starter
Member
thanks 
michael
-
Mar 27th, 2002, 12:30 PM
#6
Frenzied Member
Yes, I should yell at you because there is no document.all. 
But as Josh showed, document.getElementById works. If you look at www.w3c.org/DOM you can look at the DOM 2 recommendations and find something that may work in IE 5.x or other older browsers.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Mar 27th, 2002, 12:34 PM
#7
Thread Starter
Member
I had the object in a 'form' so thats why i had document.all (but ASP/VB is my forté javascript/DOM is a bit new for me)
thanks again,
Michael
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|