Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

openBrWindow features and help

Posted on 2004-10-04
3
Medium Priority
?
1,700 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 600 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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

963 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