THE MOST DIFFICULT JavaScript QUESTION EVER!

If I want to get the location of a document, I would simply use "self.document.location". But how about getting the frame name of a self document?

This is the frameset I am using for my page:

<FRAMESET cols="145,*,145" border="0" framespacing="0">
      
      <FRAMESET rows="45,*,45" border="0" framespacing="0">
            <FRAME src="name.html" name="leftname" scrolling="no" frameborder="0" marginheight="0" marginwidth="0" noresize>
            <FRAME src="left.html" name="left" scrolling="no" frameborder="0" marginheight="0" marginwidth="0" noresize>
            <FRAME src="scroller.html" name="leftscroller" scrolling="no" frameborder="0" marginheight="0" marginwidth="0" noresize>
             
      </FRAMESET>
      <FRAME src="main.html" name="main" scrolling="auto" noresize frameborder="0" marginheight="0" marginwidth="0">
      
      <FRAMESET rows="45,*,45" border="0" framespacing="0">
            <FRAME src="name.html" name="rightname" scrolling="no" frameborder="0" marginheight="0" marginwidth="0" noresize>
            <FRAME src="right.html" name="right" scrolling="no" frameborder="0" marginheight="0" marginwidth="0" noresize>
            <FRAME src="scroller.html" name="rightscroller" scrolling="no" frameborder="0" marginheight="0" marginwidth="0" noresize>
             
      </FRAMESET>
      
</FRAMESET>

So, I am using the "name.html" as the frames "leftname" and "rightname". I would like to make a simple alert from the "name.html" making it show its own frame name.

To understand this confusion better, I will tell you exacly what I want:
1- The leftname frame (name.html) will load first and I want it to alert its own name (but just its own name!): "leftname".
2- After a little while, the rightname frame will be loading (it is the "name.html" too!) and I want it to alert its own name (but just its own name too!): "rightname".

And I want to do that using only one code!! I guess it will be something looking like "self.document.frame.name.value" or "self.parent.document.frame.name"..

Oh... well... this is confuse!
LVL 1
superquestionsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kollegovCommented:
Easy.....
to alert name from frame itself you need only:

alert(window.name)


0
Christian_WenzCommented:
good job! :-)
0
superquestionsAuthor Commented:
I tried, but the alert message was "undefined" for the frame named "leftname" and the other alert was "undefined" too for the frame named "rightname"! What I want is to alert "leftname" for the frame named "leftname" and to alert "rightname" for the frame named "rightname"! --> the problem is... I am using the same html file for both frames!
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

superquestionsAuthor Commented:
This is the "name.html":

<HTML>
<HEAD>
      <SCRIPT>window.defaultStatus='WareZone - The Ultimate Zone of Warez';</SCRIPT>
</HEAD>
<BODY background=namebg.jpg topmargin=0 bottommargin=0 leftmargin=0 rightmargin=0 marginwidth=0 marginheight=0>
      
      <TABLE border=0 cellpadding=0 cellspacing=0 height=100% width=100%>
            <TR valign="middle" align="center">
                  <TD>
<script>if(this.damn.document.frame.name == leftname)
{document.write('<img src=warez.jpg>')}
else if (this.document.which.is.making.me.angry.frame.name == rightname) {document.write('<img src=other.jpg')}</script>
                  </TD>
            </TR>
      </TABLE>
</BODY>
 
</HTML>
</BODY>
 
</HTML>

-------------------> READ THE SCRIPT! That is what I want to do... and... by the way... do you have a homepage?
0
kollegovCommented:
I checked this solution with frameset
which loaded the same html in both frames
and this work in NN3 and NN4, MIE4 for win 95
You so not need to put anytthing else, just copy and paste
this script into your HTML without any changes.
In default context of window should be current frame object

<script>
 alert(window.name)
</script>
0
superquestionsAuthor Commented:
Give me your UIN and we will be able to talk in real time. What do you think? It will be easier for us... mine is 5816043... but how about you?
0
kollegovCommented:
you should compare:
window.name+""=="leftname"
I guess you have 'undefined' on leftname.
without " browser consider it a variable name
which is undefined.

0
superquestionsAuthor Commented:
And don't repeat the word easy again! My name is superquestions... and it could make me really sad...
0
kollegovCommented:
Sorry, Superquestions, I do not have ICQ :( Still it once crashes my filesystem, I do not trust this program.
And it useless this time of day, when connection to thier site from heart of Russia is so slow.
0
superquestionsAuthor Commented:
WAHAHAHAHAHHAHAHHAAHAHAHAHAHAHAH!!! IT WORKED!!! THANK YOU VERY MUCH!!! Give me your UIN... or your homepage address and I will give you an "A" (more one, eh?)!!!
0
kollegovCommented:
What browser you use? Probably this is browser specific problem?
0
kollegovCommented:
Just click on my Name at the left of this message, you will find my homepage address. And there you will find my e-mail if you need it next time :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
superquestionsAuthor Commented:
Hmm... you helped me... we are talking in real time right now... hehe..
0
superquestionsAuthor Commented:
I will send you an e-mail soon! I NEED YOUR UIN (I will help you having one...)! And.. by the way.. I am not in the USA, I am in Brazil and there is more than one Mirabilis ICQ server in this world.. there is an option in... ICQ --> Preferences --> Servers to change the servers, then your connection from the middle of Russia would be faster! And the main Mirabilis ICQ server is in Israel, not in the USA!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.