views:

47

answers:

2

Apparently, this call to window.open is not valid under Internet Explorer. The Javascript code on my site is not running, I would assume it is due to that error.

The line it tells me the error is on, is the call to window.open, apparently an argument is not valid there.

$('.objeto').click( 
        function() {
            var center   = 'height=380,width=900,top='+((screen.width - 900)/2)+',left='+((screen.height - 380)/2);
            var address = $(this).attr('id');
            window.open (address,'Ver articulo', config=center); 
        }
    );

The site runs fine under both Google Chrome, and Firefox.

+2  A: 

In IE, you can't have spaces in your second variable (the new window's name).

Try:

window.open (address,'Ver_articulo', config=center); 
Dan Dumitru
You, sir, are a gentleman and a scholar. This is the answer. I'm also having troubles with JQuery compability on IE. It tells me that there is an error on the JQuery code I get from http://jqueryjs.googlecode.com/files/jquery-1.3.js.Non-Valid argument on line 4031, it says.
serv-bot 22
@serv-bot - Well, I already have the Scholar badge. Now, if I also had a green sign next to my answer... :)
Dan Dumitru
About your jQuery error, that's weird, you should post a new question about that.
Dan Dumitru
Hahaha, you'll get it. Remember I have to wait 10 minutes until I can vote on the answer. Any ideas on my inquiry? Or should I post another question?
serv-bot 22
Aaa, right, I forgot about the limit to pick an answer.
Dan Dumitru
+2  A: 

I'm not sure what config is, you just need:

window.open (address,'VerArticulo', center);

Keep in mind though, it looks like your id attribute is invalid to get the effect here, you probably want to use something different, e.g. data-href="urlHere" on the element, if it's not an anchor already.

Nick Craver
I'm parsing the URL trough the id attribute, since the tags are auto-generated with a php script that gets the information from a mysql table. It's working on all major browsers. Is there a reason why I shouldn't be doing that?
serv-bot 22
@serv-bot - Invalid IDs can have all sorts of side-effects and inconsistent behavior, it's better to use an attribute where an href is expected, or at the very least, an invalid ID *isn't* expected.
Nick Craver
What do you mean by invalid ID? The different DIV boxes are generated as such... $id = $row['id']; echo "<div id='verauto.php?fid=$id' class='objeto'>";And there is no chance of them being repeated.
serv-bot 22
@serv-bot - You can see the spec [here](http://www.w3.org/TR/REC-html40/types.html#type-name) : "ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")." So that querystring portion isn't valid :) It'd be better to use a data attribute, e.g. `data-href="verauto.php?fid=$id"` and `.attr("data-href")` here.
Nick Craver
Thanks! I'll make the corresponding change then, for the sake of using the language right. You have been incredibly helpful, and I was wondering if I could get your insight on this other question I'm about to post. :)
serv-bot 22