www.webdeveloper.com
Results 1 to 2 of 2

Thread: window.onclick accepts only one parameter

  1. #1
    Join Date
    Dec 2010
    Posts
    1

    window.onclick accepts only one parameter

    Hi. I'm trying to write a script that opens a formatted html window as instructed here:
    HTML Code:
    http://www.fontstuff.com/frontpage/fptut06.htm
    .

    His code works right, but when I test it, it works only when I exlude the second and third parameters of window.open().

    Here's what I'm testing:

    Code:
    <html>
    <head>
    <style type="text/css">
    .quasiLink {color:#0000FF; cursor:hand}
    </style>
    </head>
    
    <body>
    
    <span class="quasiLink" onClick=javascript:window.open("delegateConnect.html", 
    "blank","toolbar=no,width=180,height=250,top=0,left=0")>
    I'm a Pastor or Church Delegate
    </span>
    
    </body>
    </html>
    Am I overlooking something?

  2. #2
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,773
    I suspect the lack of quotes around the onclick attribute are to blame.

    onclick='window.open( ... )'

    Also, the javascript: part is not needed. That's actually a protocol identifier in the case you want to embed JavaScript in the href attribute of the <a> tag. The value of the onclick attribute is assumed to be JavaScript, therefore you don't need to tell the browser to interpret it as JavaScript.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles