Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: javascript:window.open

  1. #1
    Join Date
    Dec 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default javascript:window.open

    Please help. I am having trouble with this coding.

    eg. IMAGE (on line 120)
    <a href="#" SPAN class=popup
    onclick='javascript:window.open("file:///url.htm","blank","toolbar=no,location=no,width=600,height=350,top=0,left=0,scrollbars=yes")'; return false;"><span style="text-decoration: none; font-weight:700"><img border="0" src="image.jpg" width="35" height="35" alt="images"></span></a>

    I want to determine the precise location of the pop-up (on line 120 and not at the top of the page).

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Code:
    onclick='javascript:window.open("file:///url.htm","blank","toolbar=no,location=no,width=600,height=350,top=0,left=0,scrollbars=yes")'; return false;">....
    quite a few problems--

    Quotes must match... you open with a single quote, and close with double. Also, for html attributes, use double quotes. Inside javascript, use single. And javascript: is an alternate way to use javascript that I've only seen used with a elements within the href part.... href="javascript:....", not like this. onClick is javascript to begin with, so no need to set that.

    Here's the fixed version:
    Code:
    onclick="window.open('file:///url.htm','blank','toolbar=no','location=no','width=600',height=350,top=0,left=0,scrollbars=yes'); return false;">
    And... I give up now. You have no quotes around the attributes in the function near the end, and not sure if you define it like that (I'm no JS expert). I'm not used to seeing something=value, within a function like that. Not sure how to fix it. I'd suspect that it's just the value... like 600, not width=600, but not exactly sure. Where did you get the code? I'm sure it tells you somewhere...
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Dec 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Please don't give up on me I am new to all these codes. I will try your fixed code and report back. Thank you for your help.

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    its the exact same as making a pop up in Flash (as that uses JS as well....

    take what you can from this snippet:

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    	function popup() {
    	window.open('pagetopopup.html','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=100,height=100,left=200,top=200');
    }
    </script>
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Ok, I'm off on the inner quotes. That looks like it should work. I'm just not used to that format. I really need to figure out Javascript sometime soon... I just do PHP. Heh.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    The joys of AS and JS being so similar I don't know much JS either. I am doing the w3c lessons on it right now, though, piecing it together as best I can. It's not as hard as I thought it would be though, so that helps.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  7. #7
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by BLiZZaRD View Post
    The joys of AS and JS being so similar
    They are both ECMAScript implementations.

    I don't know much JS either. I am doing the w3c lessons on it right now ...
    As far as I'm aware, the W3C have no lessons on ECMAScript or its derivatives. Are you getting confused with W3Schools? These are entirely unrelated sites.

    I'm far from impressed by W3School's tutorial. They confuse the language and objects provided by the host, they perpetuate script "hiding" nonsense, their understanding of variable lifetime is rudimentary, they seem to recommend using for..in statements with arrays, the summary of exception handling is abominable, they think that \& is an escape sequence and recommend line continuation in string literals using a backslash - something that's forbidden (though tolerated in some browsers). That's in the "basic" section, and far from exhaustive.

    The "test" is quite entertaining, especially with a few wrong and misleading questions, and how little it has to do with the language.

    Mike
    Last edited by mwinter; 12-19-2006 at 02:11 PM. Reason: Tutorial overview

  8. #8
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Yes sorry had validation things on my mind.

    Is there a better online tut than W3schools?
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  9. #9
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by BLiZZaRD View Post
    Is there a better online tut than W3schools?
    I don't know, but I doubt there are any good tutorials. They've never been mentioned on c.l.javascript. Tutorials are usually OK as far as syntax is concerned, but they usually fall flat on their face when it comes to usage and best practice.

    You're always welcome to ask any question about the language in the JavaScript forum, here (or in c.l.j, if you have newsgroup access). I know I'll be happy the help.

    Mike

  10. #10
    Join Date
    Oct 2006
    Location
    Dubai
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Online Tutorial

    Hi. Have u tried www.javascript.com....

    This site is also very good. Its better than w3school of thought

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •