Solved

openBrWindow features and help

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

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

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

758 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

21 Experts available now in Live!

Get 1:1 Help Now