Solved

openBrWindow features and help

Posted on 2004-10-04
3
1,678 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

734 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