pop up window on OnClick event of textbox

Results 1 to 3 of 3

Thread: pop up window on OnClick event of textbox

  1. #1
    minnie Guest

    Default pop up window on OnClick event of textbox

    I have the following code<BR>&#060;HTML&#062;<BR>&#060;BODY&#062;<BR>&# 060;form method = "POST" id="frmname" &#062;<BR>&#060;Script Language="javaScript"&#062;<BR>function popup()<BR>{clickpop=window.open("http://www.somepage.com/","clickpop","toolbar=0,location=0,status=0,menuba r=0,scrollbars=1,resizable=1,top=100,left=100,widt h=350,height=200")}<BR><BR>&#060;/script&#062;<BR><BR>&#060;input type="text" id=text1 name=text1 onclick="javascript:popup()"&#062;<BR><BR><BR>&#06 0;/form&#062;<BR>&#060;/BODY&#062;<BR>&#060;/HTML&#062;<BR><BR>this seems to work fine with IE but the pop up window does not work in NetScape.<BR>Why? Any idea? Please help!!!

  2. #2
    omc Guest

    Default RE: pop up window on OnClick event of textbox

    This is very frustrating!<BR><BR>I played with this for a few minutes. OnClick didn&#039t work in Netscape. OnMouseOver does work. OnFocus works, but then you have a hard time getting rid of the popup window. OnChange, OnKeyDown, OnKeyPress all work. The other one that would help you, OnMouseDown does not work.<BR><BR>Sorry, I think I am just restating the problem, not actually helping. But I tried!

  3. #3
    MChance Guest

    Default RE: pop up window on OnClick event of textbox

    Ok, here&#039s the deal. Strictly speaking, there is no onClick event for text field. A text field inherits the onClick event from the Input object as onChange instead. The problem there is that the onChange event actually takes some time to fire. You could try using onFocus(), but everytime you close the spawned window, it will respawn unless you give focus to some other field before spawning new window.<BR><BR>Like this:<BR><BR>&#060;HTML&#062;<BR>&#060;BODY&#062;< BR>&#060;form method = "POST" id="frmname" name="frmname"&#062;<BR><BR>&#060;Script Language="javaScript"&#062;<BR>function popup()<BR>{<BR>document.frmname.text2.focus();<BR >clickpop=window.open("http://www.somepage.com/","clickpop","toolbar=0,location=0,status=0,me<BR> <BR>nubar=0,scrollbars=1,resizable=1,top=100,left= 100,width=350,height=200")}<BR><BR>&#060;/script&#062;<BR><BR>&#060;input type="text" id=text1 name=text1 onfocus="javascript:popup()"&#062;<BR><BR><BR>&#06 0;input type="text" id=text2 name=text2&#062;<BR>&#060;/form&#062;<BR>&#060;/BODY&#062;<BR>&#060;/HTML&#062;<BR><BR>The drawback here is that the form element you give focus to cannot be hidden. You also need to make sure that your form has a name, not just an id, because NS doesn&#039t look at the id value.<BR><BR>I hope this makes sense.<BR><BR>Mark Chance

Posting Permissions

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