Solved

openBrWindow features and help

Posted on 2004-10-04
3
1,684 Views
Last Modified: 2012-05-05
I'm using the script

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features); }

Now I'm using a CMS to put this into my page and I'm trying to find the easiest way of doing things. So can someone tell me if this works and how to do the following. I have the following code in my page.

<A onclick='MM_openBrWindow("/screens1.jpg",menubar="no",scrollbars="no",resizable="no",status="no")' href='#"'><IMG height=100 alt="" src="/screens1.jpg" width=100 border=0></A>

Is there a way to call the src from the image sourse it relates to so I don't have to key in the picture name twice. Something like.....
<A onclick='MM_openBrWindow(getURL)' ..........or something like that

Is there also a way to make the window size the same width and height as the real picture, so that when it's clicked on the image fits nice and neatly.

If anyone has a list of known fetaure commands that would be helpfull as well. (eg: scrollbars, resizable)

Sorry just new to this function. :0)

thanks in advance

Hep
0
Comment
Question by:MrHep
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 150 total points
ID: 12223692
Hi MrHep,

Fore your first question, I would recommend removing the onclick from the <a>. Instead, have this:

<a href="pictureSrcIfNoJavaScript.gif" onclick="return false;" target="_blank"><img src="picture.gif" name="myPic1" onclick="MM_openBrWindow(this.src,this.name,'features');" /></a>


As to set the window size to your picture, I would recommend for you to open this page:

<html>
<head>
<title>Loading Picture...</title>
<script language="javascript">
<!--

function loadPic() {
   var thesrc="about:blank";
   var chopurl=window.location.href.split("?");
   var chopurl=chopurl[1].split("&");
   for (var i=0;i<chopurl.length;i++) {
      if (chopurl[i].indexOf("pic")) {
         thesrc=chopurl[i].split("=")[1];
         break;
      }
   }
   document.images['loadImage'].src=thesrc;
   window.resizeTo(document.images['loadImage'].width,document.images['loadImage'].height);
   window.location=thesrc;
}

//-->
</script>
</head>
<body onload="loadPic();">
<div style="visibility:hidden;">
<img name="loadImage" src="" />
</div>
</body>
</html>


Then, of course, call it like this:

<img src="myImage.src" name="myName" onclick="MM_openBrWindow("theHTMLAbove.html?pic="+this.src,this.name,'features');" />



As for the list of features:

http://www.webreference.com/js/column7/attributes.html

Regards,
Zyloch
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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 …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
Suggested Courses

617 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