PDA

View Full Version : Quick Javascript Help




Grimace
Aug 22, 2006, 09:31 AM
Hi all, I am pulling my hair out trying to figure out why my basic javascript code for a popup window won't work with Firefox or IE (it works fine with Safari!) A blank page opens in Firefox (view source reveals just the <html><head><body> tags). Page can't be displayed shows up in IE.
---------------------------------------------------------------
In the <head> section:

<script language="javascript">

function test(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=500');");
}
</script>
--------------------------------------------------------------

In the <body> section:

<a href="javascript:test('http://www.google.com')">Google</a>



Palad1
Aug 22, 2006, 10:00 AM
<script>
function test(URL)
{
var id=new Date().getTime();
var w=window.open(URL,id,'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550, height=500');
}

</script>
<a href="javascript:test('http://www.google.com')">url</a>


Javascript is not strictly-typed, use this to your advantage ;)

Grimace
Aug 22, 2006, 10:10 AM
hmm....I still get nothing. :( Shouldn't the </script> show up in a similar font (I'm using DW) like the first one?

Palad1
Aug 22, 2006, 11:58 AM
There was a typo, add a single quote before toolbar and you're set to go :)