Solved

openBrWindow features and help

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
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…

770 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