Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check condition before open a popup window

Status
Not open for further replies.

discusmania

IS-IT--Management
Oct 24, 2000
158
AP
Dear all...
anybody know how to check a condition before open a popup window. for example in for add.asp i have an input field called line_name and a button named "open popup". the onclick even handler for the button will open a popup window: I want the program to be able to check whether the line input box has value or not. if has value, proceed to open the popup, else prompt a message to user. here's the script without the condition:

<html>
<head><title>open popup with condition</title>

<!-- upload popup window -->
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
function popUp(URL) {
day = new Date();
id = day.getTime();
eval(&quot;page&quot; + id + &quot; = window.open(URL, '&quot; + id + &quot;', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=250,height=180,left = 462,top = 334');&quot;);
}
// End -->
</script>

</head>

<body>

<INPUT TYPE=&quot;text&quot; name=&quot;line_name&quot;><p>

<INPUT TYPE=&quot;button&quot; name=&quot;openpopup&quot; value=&quot;Open Popup&quot; onClick=&quot;javascript:popUp('
</body>
</html>


thanks for your help
NEW IN ASP
NOR
 
Hi.

Try to insert the following code to your function .

function popUp(URL) {

var isEmpty=document.all.line_name.value;
if(isEmpty!=&quot;&quot;){

... your code here...

}else{
alert(&quot;The input box is empty!&quot;);
}

hope its help.
regards, Kirilla
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top