Solved

Pop-up mini windows

Posted on 2004-04-04
14
451 Views
Last Modified: 2013-11-28
I'm building a site and I'm using some terms that I want the definitions to pop-up in miniature windows.

This is the sentence I'm working on.

You can also make it <script type="text/javascript">
function openwindow()
{
window.open("http://www.geocities.com/htmlhelp_club/scroll.html","my_new_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=350, height=250")
}
</script>
<a onclick="openwindow()">scroll</a> and <script type="text/javascript">
function openwindow()
{
window.open("http://www.geocities.com/htmlhelp_club/slide.html","my_new_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=350, height=250")
}
</script>
<a onclick="openwindow()">slide</a>.

The problem is that they both open to the "slide" definition. Help please?
0
Comment
Question by:kgpretty
  • 5
  • 3
  • 2
  • +1
14 Comments
 
LVL 12

Accepted Solution

by:
lil_puffball earned 50 total points
ID: 10753950
You can't have 2 function with the same name. Use this function instead:
--------------------------------------------
<script type="text/javascript">
function openwindow(url)
{
window.open("http://www.geocities.com/htmlhelp_club/"+url,"my_new_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=350, height=250")
}
<a onclick="openwindow('scroll.htm')">scroll</a>
<a onclick="openwindow('slide.htm')">slide</a>
0
 
LVL 25

Expert Comment

by:devic
ID: 10754001
don't worry, if it does not work, just rename htm to html ;)
0
 
LVL 12

Expert Comment

by:lil_puffball
ID: 10754049
oops. Thanks devic for catching that, I always name my files .htm so I assumed everyone used that--DOH! x_x
0
 
LVL 25

Expert Comment

by:devic
ID: 10754086
hehe and i always name my files .html ;)

btw all attributes with value "no" are optional.

window.open("http://www.geocities.com/htmlhelp_club/"+url,"my_new_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=350, height=250")

equal to:
window.open("http://www.geocities.com/htmlhelp_club/"+url,"my_new_window", copyhistory=yes, width=350, height=250")
0
 
LVL 17

Expert Comment

by:mreuring
ID: 10755693
And to my knowledge spaces are not allowed in the atribute list? Plus, you forgot a quote in that last statement devic :)
window.open("http://www.geocities.com/htmlhelp_club/"+url,"my_new_window", "copyhistory=yes,width=350,height=250");
0
 
LVL 25

Expert Comment

by:devic
ID: 10755739
space is ok, but for the quote thanks ;)


space can be critical here:
<span onclick=showit(1, 2)>show2</span>
but with this no:
<span onclick="showit(1, 2)">show2</span>


<script>
function showit(a,b)
{
      alert(a+"\n"+b);
}
</script>
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 17

Expert Comment

by:mreuring
ID: 10755773
I didn't mean the arguments of the function but specifically the list of arguments you sent along to the opener to determine the width and height of the window. I just had to look it up and here's the reference:
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/window.html#1202731

A direct quote from that:
"windowFeatures is an optional string containing a comma-separated list of options for the new window (do not include any spaces in this list). After a window is open, you cannot use JavaScript to change the windowFeatures."

Quite likely some browsers may accept a feature list containing spaces, but it's best to keep them out, I know for a fact that netscape 4 won't render the new window properly (only accepting the first option and ignoring the rest) and it's likely not the only one...
0
 
LVL 25

Expert Comment

by:devic
ID: 10755827
ach, ns 4 :), i don't care aboute ns4 anymore.
but anyway, if without space is better, then is better ;)
0
 

Author Comment

by:kgpretty
ID: 10758437
Thankyou!
0
 
LVL 25

Expert Comment

by:devic
ID: 10761123
hi kgpretty,

btw you can read about "What's the right grade to give? "

http://experts-exchange.com/help/closing.jsp#7
0
 
LVL 12

Expert Comment

by:lil_puffball
ID: 10761140
Thank you devic. :)

kgpretty, thanks for the points. But if there's nothing wrong with my answer, A is the right grade to give. I hope you don't mind if I post a question to change the grade? :)
0
 

Author Comment

by:kgpretty
ID: 10771768
lol.. A is perfect. atleast thats what I thought. In the code you gave me, you put .htm instead of what I had. I was confused for a minute. It wasn't perect.. so I gave you a B.
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Marketing can be an uncomfortable undertaking, especially if your material is technology based. Luckily, we’ve compiled some simple and (relatively) painless tips to put an end to your trepidation and start your path to success.
Owning a franchise can be the dream of a lifetime. It provides a chance for economic growth. You can be as successful as you want.  To make your franchise successful, you need to market it successfully. Here are six of the best marketing strategies …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now