Solved

Pop-up mini windows

Posted on 2004-04-04
14
447 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Read about the 3 stages of the buyer's journey: awareness, consideration, and decision.
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.
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…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

747 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

11 Experts available now in Live!

Get 1:1 Help Now