...

View Full Version : href="#" returns error on page in IE6



svoltmer
01-04-2007, 06:16 PM
I am trying to make a link that will call a function which opens a sized window with a html doc in it. My code works for Firefox and Safari, but not IE6. Take a look and let me know what you think. Thanks.

function Open_Win()
{
window.open("http://www.crosst.org/Touching-God-Fast.html","Touching God Fast","scrollbars=yes, statusbar=yes, height=500, width=850");
}


<a href="#" onClick="JavaScript:Open_Win();"><image>

coothead
01-04-2007, 06:29 PM
Hi there svoltmer,

IE does not accept this...

Touching God Fast
...so change it to this...

Touching_God_Fast
...or to this...

TouchingGodFast
coothead

svoltmer
01-04-2007, 06:46 PM
Thanks!!

I didn't even think about the spaces on the title being a problem.
Huge help!!

Also.. which is more approprate, window.open or document.open? Thanks Again.

coothead
01-04-2007, 06:55 PM
Hi there svoltmer,

window.open is appropriate. ;)
Note that your method will not work for those with javascript disabled, they will see nothing and, consequently, carry on eating. :eek:
This method will prevent that...


<script type="text/javascript">
var mywindow;
var features='scrollbars=yes,statusbar=yes,height=500,width=850';
window.onload=function() {
document.getElementById('touch').onclick=function() {
Open_Win(this.href);
return false;
}
}
function Open_Win(url){
mywindow=window.open(url,'TouchingGodFast',features);
mywindow.focus();
}
</script>

<a id="touch" href="http://www.crosst.org/Touching-God-Fast.html">
<img src="http://www.crosst.org/images/Touching-God-Fast.jpg" alt=""/>
</a>

coothead

liorean
01-04-2007, 06:58 PM
window.open opens a new window.
document.open creates a new document replacing the current document, and opens it for parsing.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum