Solved

Open Browser Window

Posted on 2004-08-15
3
357 Views
Last Modified: 2006-11-17
I want to have a simple little pop up type window open when I click on a peice of text. I am using this function:

function MM_openBrWindow(myURL,winName,features) {
      window.open(myURL,winName,features);
}

And calling it this way:
            <a href="ProductWindows/Moped.htm"onMouseDown="MM_openBrWindow('ProductWindows/Moped.htm','Mighty Aphrodite','scrollbars=yes,resizable=yes,width=500,height=400')">Moped</a>

But I keep getting the debug error that I have an incorrect argument in the function itself. It's been a while since I used this and I had no problems before that I can remember.
Any ideas? Or better ways of doing this?
Thanks
0
Comment
Question by:SmartGirl
3 Comments
 
LVL 13

Accepted Solution

by:
StormyWaters earned 125 total points
ID: 11806111
I can't tell because of a line break, but you can't have spaces in the window name.
Secondly, why is there a href if it's opened in a new window?
Thirdly, why are you using onMouseDown? It should be onClick.

So:

<a href="#" onClick="MM_openBrWindow('ProductWindows/Moped.htm', MightyAphrodite', 'scrollbars=yes,resizable=yes,width=500,height=400')"Moped</a>
0
 
LVL 3

Assisted Solution

by:pulupul
pulupul earned 125 total points
ID: 11806118
And, IMHO, better:

<a href="javascript:MM_openBrWindow('ProductWindows/Moped.htm',MightyAphrodite', 'scrollbars=yes,resizable=yes,width=500,height=400')">Moped</a>
0
 

Author Comment

by:SmartGirl
ID: 11806126
Thanks,
I actually found this that works fine:
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=300,left = 262,top = 134');");
}
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

708 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

16 Experts available now in Live!

Get 1:1 Help Now