I am not a java guy.. but made this code ( to open new page sized.. on another page of mine

but darn i can not get it to do so on this page?

Is it a DIV thing... new to these tags too///

http://www.mastar.com/Presentations.html
Where it say Teamviewer button the Help link to call the page in the Presentation folder name TeamViewer_access.html

cut npaste snippet

<br>
<div class="presentationscontentbox3">
<h1><strong>SUPPORT</strong></h1>
<div class="prebox1">
<p>To get started:<br>
<span class="more_link do_not">OPTION 1</span><br>
Go to<br>

<a href="http://www.logmein.com/">
<img src="images/logmeIn_logo.jpg" alt="LMI" width="129" height="41"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="Presentations/LogMeIn_access.html">Help</a><br>
</p>
<p>&nbsp;</p>
<p><span class="more_link do_not">OPTION 2</span><br>
Go to<br>


<a href="http://www.teamviewer.com/index.aspx"><img src="images/teamview.jpg" alt="teamviewer" width="164" height="47"></a>&nbsp;&nbsp;&nbsp;<a href="javascript:openWindow( 'Presentations/TeamViewer_access.html',400,400,0,0,0,0 ,0,0,10,10)">Help</a>

</a> </p>
<p>&nbsp;</p>


</div>
</div>
<br>
<br>
<br>

Recommended Answers

All 3 Replies

Rodmaster,

The simple answer is to use the correct syntax for opening a new browser window from JavaScript, as defined eg. here.

A more comprehensive solution is to create your own function openWin() as follows:

<script language="JavaScript" type="text/javascript">
function openWin(url, name, mySpecs){
	var url = (!url) ? '' : url;
	var name = (!name) ? '' : name;
	var specs = {//Hash of default values; for definitions see http://www.w3schools.com/HTMLDOM/met_win_open.asp
		channelmode : '0',
		directories : '1',
		fullscreen : '0',
		height : '',
		left : '0',
		location : '1',
		menubar : '1',
		resizable : '1',
		scrollbars : '1',
		status : '1',
		titlebar : '1',
		toolbar : '1',
		top : '0',
		width : ''
	};
	var prop;
	specs.compose = function(){
		var specsArray = new Array();
		for(prop in specs){
			if(typeof specs[prop] != "function"){
				specsArray.push( prop + '=' + specs[prop] );
			}
		}
		return specsArray.join(',');
	};
	if(mySpecs){//Override default values with mySpecs values.
		for(prop in mySpecs){ specs[prop] = mySpecs[prop]; }
	}
	window.open( url, name, specs.compose() );
	return false;
}
</script>

This will allow you to override javascript's default values for each of the "specs" parameters, either by changing the values in the specs hash within the function, or (more typicaly) by passing in a hash of your own as the third parameter when calling openWin().

Hence, your call might look something like this:

<a href="" onclick="return openWin('Presentations/TeamViewer_access.html', 'TeamViewer', {width:400,height:400,left:10,top:10});">Help</a>

Airshow

Rodmaster,

The simple answer is to use the correct syntax for opening a new browser window from JavaScript, as defined eg. here.

A more comprehensive solution is to create your own function openWin() as follows:

<script language="JavaScript" type="text/javascript">
function openWin(url, name, mySpecs){
	var url = (!url) ? '' : url;
	var name = (!name) ? '' : name;
	var specs = {//Hash of default values; for definitions see http://www.w3schools.com/HTMLDOM/met_win_open.asp
		channelmode : '0',
		directories : '1',
		fullscreen : '0',
		height : '',
		left : '0',
		location : '1',
		menubar : '1',
		resizable : '1',
		scrollbars : '1',
		status : '1',
		titlebar : '1',
		toolbar : '1',
		top : '0',
		width : ''
	};
	var prop;
	specs.compose = function(){
		var specsArray = new Array();
		for(prop in specs){
			if(typeof specs[prop] != "function"){
				specsArray.push( prop + '=' + specs[prop] );
			}
		}
		return specsArray.join(',');
	};
	if(mySpecs){//Override default values with mySpecs values.
		for(prop in mySpecs){ specs[prop] = mySpecs[prop]; }
	}
	window.open( url, name, specs.compose() );
	return false;
}
</script>

This will allow you to override javascript's default values for each of the "specs" parameters, either by changing the values in the specs hash within the function, or (more typicaly) by passing in a hash of your own as the third parameter when calling openWin().

Hence, your call might look something like this:

<a href="" onclick="return openWin('Presentations/TeamViewer_access.html', 'TeamViewer', {width:400,height:400,left:10,top:10});">Help</a>

Airshow

Beautifull..

thanks smooth.. put it in my DWT and i will use it often

look more inside code later..

Thanks!. I was lookin something like that...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.