Solved

Internet Explorer cannot open the Internet site

Posted on 2002-05-30
20
1,955 Views
Last Modified: 2012-05-04
hi Experts,

Please give your comments on how I can solve this problem. Thanks a lot for your time !!

I've an asp file. I used a javascript validation check to ensure that a textfield has data. On the first
time, the error msg successfully show, but goes to a blank page. From then onwards, I've this error
when I try to refresh my page.


Internet Explorer cannot open the Internet site
javascript:CheckProduct();||http://localhost/program.file.asp

Operation aborted



Dawn.
0
Comment
Question by:Dawn_rico
  • 8
  • 7
  • 4
  • +1
20 Comments
 
LVL 15

Expert Comment

by:a.marsh
ID: 7044253
Can you post the code for us?

Based on:

javascript:CheckProduct();||http://localhost/program.file.asp

My guess would be that you have done something like this:

<a href="javascript:CheckProduct();||http://localhost/program.file.asp">

which is not valid!

Ant
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7044265
Show the A-tag.

CJ
0
 

Author Comment

by:Dawn_rico
ID: 7044324
hi a.marsh and CJ_S,

Thanks for lending your hands :)

--------------------------------------------------------
<script language="JavaScript">
<!--
function CheckProductCode()
{
     //Declaration
     var formName = document.Sales003;
     var valid;
     
     if(formName.txt_ProdCode.value == "")          
     {
          //Check for : empty field
          alert("Please enter the Product Code");    
          valid = false;
     }
     else    
     {
          valid = true;
     }
     return valid;
}
//-->
</script>




<a href="javascript:return CheckProductCode();">
---------------------------------------------------------

Please let me know if you need more info and thanks.

Dawn.





 

0
 

Author Comment

by:Dawn_rico
ID: 7044336
more ...

http://localhost/program.file.asp is this fileA's name.

this fileA is one of the frames in my mainframe & I got this error when I try to refresh the main frame.

I've used in my code too.
<form name="003" action="003.asp" method="post" onSubmit="return CheckProductCode();">
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 7044353
Any chance of seeing the whole page in order to get a firm grip on how you are using all the above together?

Ant
0
 
LVL 1

Accepted Solution

by:
steve-e-b earned 100 total points
ID: 7044363
By the looks of what you've posted so far, you want to disable the link (to http://localhost/program.file.asp) if the product code is not valid.

The JavaScript function is fine.
But, like a.marsh suggests the anchor tag might need to be altered. Try this:

<a href="http://localhost/program.file.asp" onclick="return CheckProductCode()">

The onclick handler will cause the clicking of the link to be ignored if the product code is invalid.

hope this helps,
Steve
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7044369
<a href="#" onClick="return CheckProductCode();">

the form-tag onsubmit is okay IMHO...
0
 

Author Comment

by:Dawn_rico
ID: 7044374
sure, my code is messy ... a moment pls ..

0
 

Author Comment

by:Dawn_rico
ID: 7044388
<%@ Language=VBScript %>
<% Option Explicit %>
<% 'For redirection
Response.Buffer = true
%>

<%'Enables database connection%>
<!--#include file="database_open.asp"-->

<%'Get dynamic data%>
<!--#include file="006.asp"-->

<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title></title>
<style>
            A:link {text-decoration: underline;color:#000000}
            A:visited {text-decoration: underline;color:#000000}
            A:active {text-decoration: underline;color:#000000}
            A:hover {text-decoration: underline; color:#000000}
</style>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//----------------- Check Product Code ---------------------
function CheckProductCode()
{
      //Declaration
      var formName = document.003;
      var valid;
      
      if(formName.txt_ProdCode.value == "")             
      {
            //Check for : empty field
            alert("Please enter the Product Code");      
            valid = false;
      }
      else      
      {
            valid = true;
      }
      return valid;
}
//-->
</script>
</head>

<body bgcolor="#BFBFBF" text="#000000" onLoad="MM_preloadImages('icon_screenBToogle_down.gif','icon_addItem_down.gif','images/icon_addItem_down.gif','images/icon_screenBToogle_down.gif')" leftmargin="6" topmargin="9">
<!--<form name="003" action="003.asp" method="post" onSubmit="return CheckProductCode();">-->
<form name="003" action="003.asp" method="post">

<%
'== CALL MAIN ===================================================================
Call Process_View_Payment
'== END MAIN ====================================================================
%>

<%'== START PROCESS Process_View_Payment ===================================%>
<%
Sub Process_View_Payment()

'Declaration
      Dim prodTemp_TotPayable            'Total payable
      Dim prodTemp_WithGST            'Total payable, inclusive of GST

'Get Total Payable      
      prodTemp_TotPayable = session("TotPayable")      
      prodTemp_WithGST = prodTemp_TotPayable * ((session("gstRate")+100)/100)            
%>

  <table width="807" border="0" cellspacing="0" cellpadding="0" height="2">
    <tr>
      <td height="33" valign="middle" align="left" width="146"><font face="Arial" size="2">
        <input type="text" name="txt_ProdCode" size="20"></font>
        </td>
      <td height="33" valign="middle" align="left" width="252"><font face="Arial" size="2">&nbsp;
              <a href="javascript:return CheckProductCode();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('AddItem','','images/icon_addItem_down.gif',1)">
                  <img name="AddItem" border="0" src="images/icon_addItem_up.gif" width="115" height="24" alt="Add Item"></a>
             
              <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('ScreenBToogle','','images/icon_screenBToogle_down.gif',1)">
                  <img name="ScreenBToogle" border="0" src="images/icon_screenBToogle_up.gif" width="115" height="24" alt="Screen B Toogle"></a>
                  </font>
        </td>
      <td height="33" valign="middle" align="center" width="379" bgcolor="#CCCCCC">
              <font size="3" face="Tahoma" color="#FF0000"><b>&nbsp;Total Payable :
            <font size="2">(inclusive of <%=session("gstRate")%>% GST)</font>
        <font size="5"><%=formatcurrency(prodTemp_WithGST)%> </font></b></font>
        <!--<input type="submit" name="Submit" value="Refresh">-->
        </td>
    </tr>
  </table>
</form>

<%
End Sub
'== END PROCESS Process_View_Payment ===================================
%>

<%'Close database connection%>
<!--#include file="database_close.asp"-->

</body>
</html>
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 7044403
Are you wanting to check the form and then if it is correct, submit it when the user clicks the hyperlink?

If so then I would recommend the following changes:

Uncomment:

<form name="003" action="003.asp" method="post" onSubmit="return CheckProductCode();">

and change the link to:

<a href="#" onclick="document.forms.003.submit(); return false;">

:o)

Ant
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 22

Expert Comment

by:CJ_S
ID: 7044405
And now an html page with the output already present ;-)
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7044406
Ant,
as you  probably know:

when you call the submit method of a form from a link then the onSubmit will NOT be fired. With other words, there won't be any validation. instead you would use:

<a href="#" onclick="if(CheckProductCode()) document.forms.003.submit(); return false;">
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7044407
AY,
and don't EVER start a variable or object with a numeric value!!! No 003 but f003

CJ
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 7044418
Whoops. :oP

Yep, my mistake CJ.

A little rusty with Javascript at the moment. ;o)

:o)

Ant
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7044423
I notived that, you bad bad bad boy!!!! ;-)

Good to see you around though.

CJ
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7044426
notived = noticed
0
 

Author Comment

by:Dawn_rico
ID: 7046011
hi All,

Thanks for all your incoming helps :) Sorry to let you wait. I wanted to reply yesterday but my dail up has a problem and it was getting veri late.

Pls give me some time to try out all ur suggestions :)

Dawn.
0
 

Author Comment

by:Dawn_rico
ID: 7046205
hi All,

I've solved my problem using Steve's code.

Steve,
I've tried out your suggestion :)
<a href="http://localhost/program.file.asp" onclick="return CheckProductCode()">
It works great. I can check my validation successfully. I'll post my code in a while's time.  


CJ_S,
I've also tried out your suggestion!
<a href="#" onClick="return CheckProductCode();">
It did check successfully but when I enter data in my textbox, as I click the button, my form is not posted, but thanks for your time and efforts for thinking about my problem :) and thanks again too, I'll remember not to start my filenames with numbers.


a.marsh,
I've also implemented your method on
<form name="003" action="003.asp" method="post" onSubmit="return CheckProductCode();">
<a href="#" onclick="document.forms.003.submit(); return false;">
when I didn't enter a data in the textbox, it didn't show the error prompt, but thanks for looking through my messy codes and thinking out a solution to help me :)


Dawn
0
 

Author Comment

by:Dawn_rico
ID: 7046215
hi All,

This is my implementation.

<script language="JavaScript">
<!--
//----------------- Check Product Code ---------------------
function CheckProductCode()
{
     //Declaration
     var formName = document.File003;
     var valid;
     var productCode = formName.txt_ProdCode.value;
     
     if(productCode == "")          
     {
          //Check for : empty field
          alert("Please enter the Product Code");    
          valid = false;
     }
     else    
     {
          valid = true
     }
     return valid;
}
//-->
</script>


<form name="File003" action="File003.asp" method="post" onSubmit="return CheckProductCode();">


<a href="../File003.asp" onclick="return CheckProductCode()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('AddItem','','images/icon_addItem_down.gif',1)">




Dawn.
0
 

Author Comment

by:Dawn_rico
ID: 7046605
hi Steve,

ThaNks !

Sorry, I forgot :>

Dawn.  
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now