![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Programmer
|
Built-in functions?
So I'm designing a little site to learn JavaScript and DHTML, and it's going to be a mini Window Manager. Yea, I'm kinda' crazy. Anyways...
http://grog.mine.nu/~lance I'm trying to make the top 'taskbar' focus onto a window. If they overlap, I want the taskbar to change focus to the clicked title. But I get this... Error: document.getElementById("windowone").focus is not a function focus() is supposed to be a built-in function of every element, according to the W3C DOM Level 1 Specifications. What am I doing wrong...?
__________________
/* LANCE */ C++; /* this makes C bigger but returns the old value */ char *site = "slackwise.net", *home = "lance.slackwise.net", *pics = "flickr.com/photos/slackwise"; |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Jul 2005
Posts: 62
Rep Power: 4
![]() |
Those are java specifications, not javascript.
You can only use focus() on form elements, except in IE, which allows anything. What do you need the focus on it for? (Just wondering) |
|
|
|
|
|
#3 |
|
Programmer
|
GAH! But I swear I was reading their page on JavaScript from w3.org/DOM. Then clicked the "Specifications" link. :/
Anyways, that sucks. I'll never get my focus working. It means I'll have to code it myself... and I have no clue how. ![]() And by the way, I'm making a Window Manager. The top is a taskbar, the bottom DIV's are 'windows'. You get the picture. ![]()
__________________
/* LANCE */ C++; /* this makes C bigger but returns the old value */ char *site = "slackwise.net", *home = "lance.slackwise.net", *pics = "flickr.com/photos/slackwise"; |
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
What exactly do you want to do when you call the focus() function? Bring the window forward?
|
|
|
|
|
|
#5 |
|
Programmer
Join Date: Jul 2005
Posts: 62
Rep Power: 4
![]() |
The focus function wouldn't exactly work for that. It works a bit differently.
The best way to go at it is like you said, to make a custom function. It would just have to change the Z-index if I remember correctly. |
|
|
|
|
|
#6 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
That's exactly what I was thinking.
// assuming you have an array of windows called "windows"
function focus (element)
{
element = document.getElementById(element);
i = 0;
for (i = 1; i <= windows.length; i++)
{
windows.style.z-index = i;
}
element.style.z-index = i;
} |
|
|
|
|
|
#7 |
|
Programmer
|
z-index? I'll check it out.
![]() And I'll check your code out later, Ooble. If I can't figure it out myself. You're half ruining the fun of coding this. You're making it lose hack value. ![]() But thanks for your help. ![]()
__________________
/* LANCE */ C++; /* this makes C bigger but returns the old value */ char *site = "slackwise.net", *home = "lance.slackwise.net", *pics = "flickr.com/photos/slackwise"; |
|
|
|
|
|
#8 |
|
Programmer
Join Date: Jul 2005
Posts: 62
Rep Power: 4
![]() |
You could always find another way of coding it. I konw it's annoying to do so, but meh.
Also, is the drag and drop yours? Because it looks familiar. |
|
|
|
|
|
#9 |
|
Programmer
|
var zindex = 5;
function raise(element)
{
document.getElementById(element).style.zIndex = zindex;
zindex++;
}Yep. I did it. Simple. Ooble: You made it more complex than it needed to be. :/ Eryk: They were actually taken from a tutorial. --> http://www.brainjar.com/dhtml/drag/ Rest of the code is mine. ![]()
__________________
/* LANCE */ C++; /* this makes C bigger but returns the old value */ char *site = "slackwise.net", *home = "lance.slackwise.net", *pics = "flickr.com/photos/slackwise"; |
|
|
|
|
|
#10 | |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|