473,569 Members | 3,015 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Function written in javascript is not working in internet explorer

34 New Member
Hello guys
i have one function which converts the ip/netmask into networkid/netmask and also it shows the message to user that his ip is changed to network id. but that function is working in mozilla perfectly but not in IE.

To check where is the fault i have written so many alert() but sometimes these are working.
Please someone read my code and tell me why its not working.
i am also sending you the function validateIPandNe tMask()
my alert statement is commented so that one can understand my code
Expand|Select|Wrap|Line Numbers
  1. var enteredip;
  2.     function validateIPandNetMask()
  3.     {
  4.  
  5.        enteredip=document.addform.ipaddress.value
  6.        firstvalue=document.addform.ipaddress.value;
  7.        //alert("fstvalue="+firstvalue)
  8.        ipnetmaskarr=firstvalue.split("/");
  9.        ip=ipnetmaskarr[0];
  10.        nm=ipnetmaskarr[1];
  11.        //alert("ipnetmask0="+ipnetmaskarr[0]+"ipnetmask1="+ipnetmaskarr[1]);
  12.        if(ipnetmaskarr[1]==null)
  13.        {
  14.             if(validateIPAddress(ipnetmaskarr[0]))
  15.             {
  16.                if(isBrowserIE())
  17.                 {
  18.                     window.returnvalue=addform.userid.value+'/'+addform.ipaddress.value;
  19.                 }
  20.                 else
  21.                 {
  22.                     opener.document.viewform.userid.value=document.addform.userid.value;
  23.                     opener.document.viewform.ipaddress.value = firstvalue;
  24.                     opener.document.viewform.mode.value = "<%=FWBMModes.ADD%>";
  25.                     opener.document.viewform.submit();
  26.                 }
  27.                 self.close();
  28.             } 
  29.               else
  30.             {
  31.                 alert("Enter a valid IP Address before proceeding");
  32.                 addform.ipaddress.focus();
  33.                 return false;
  34.             }
  35.        }
  36.         else
  37.         {
  38.         //alert("ip= "+ip+" nm="+nm);
  39.             if(validateIPAddress(ipnetmaskarr[0]))
  40.             {
  41.                 if(validateIPNetmask(ipnetmaskarr[1]))
  42.                 {
  43.                     if(isBrowserIE())
  44.                     {
  45.                         window.returnvalue=addform.userid.value+'/'+addform.ipaddress.value;
  46.                     }
  47.                     else
  48.                     {
  49.  
  50.                      //alert("ipnetmask0="+ipnetmaskarr[0]+"ipnetmask1="+ipnetmaskarr[1]);
  51.                         //alert("ippppp= "+ip+" nm="+nm);//In internet explorer this line is executed sometime
  52.                            var networkarr=new Array(4)//not  ok
  53.                            //alert("ip= "+ip+" nm="+nm); //This alert is not working always
  54.                         iparr=ipnetmaskarr[0].split(".");//from this nothing is happening
  55.                         //alert("iparr="+iparr);
  56.                         nmarr=ipnetmaskarr[1].split(".");
  57.                         for(i=0;i<iparr.length;i++)
  58.                         {
  59.                             networkarr[i]=iparr[i]&nmarr[i];
  60.                         }
  61.                         networkid=networkarr.join(".")
  62.                         ipnmaddr=networkid+'/'+ipnetmaskarr[1] 
  63.                         //document.getElementById('ipaddress').value=ipnmaddr;
  64.                         document.addform.ipaddress.value=ipnmaddr;
  65.                         if(firstvalue==ipnmaddr)
  66.                         {
  67.                             opener.document.viewform.userid.value=document.addform.userid.value;
  68.                             opener.document.viewform.ipaddress.value =document.addform.ipaddress.value
  69.                             opener.document.viewform.mode.value = "<%=FWBMModes.ADD%>";
  70.                             opener.document.viewform.submit();
  71.                             self.close();
  72.                         }
  73.                         else
  74.                         {
  75.                             // The networkid is displayed dynamically
  76.                                 document.fgColor="red"
  77.                                 var tbl = document.getElementById('tblgui');
  78.                                 var lastRow = tbl.rows.length;
  79.                                 if (lastRow >= 1) 
  80.                                 {
  81.                                     tbl.deleteRow(lastRow - 1);
  82.                                     var row = tbl.insertRow(lastRow-1);
  83.                                     text = document.createTextNode("The IP address("+firstvalue+") is changed to networkid");
  84.                                     row.appendChild(text)
  85.                                     document.addform.ignore.disabled=false;
  86.                                     flag=false;
  87.                                     return false;
  88.                                 }
  89.                                 else
  90.                                 {
  91.                                     var row = tbl.insertRow(lastRow);
  92.                                     text = document.createTextNode("The IP address("+firstvalue+") is changed to networkid");
  93.                                     row.appendChild(text)
  94.                                     document.addform.ignore.disabled=false;
  95.                                     flag=false;
  96.                                     return false;
  97.                                 }        
  98.                         }
  99.                     }
  100.  
  101.                  }
  102.                 else
  103.                 {
  104.                 alert("Enter a valid NetMask before proceeding");
  105.                 addform.ipaddress.focus();
  106.                     return false;
  107.                 }
  108.         }
  109.         else
  110.         {
  111.             alert("Enter a valid IP Address before proceeding");
  112.             addform.ipaddress.focus();
  113.             return false;
  114.         }
  115.       }
  116.     }
Oct 5 '07 #1
3 2914
dmjpro
2,476 Top Contributor
What do you mean by "sometimes these are working." ?

Kind regards,
Debasis Jana
Oct 5 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
BibhuAshish, welcome to TSDN!

Please use code tags when posting code:

[CODE=javascrip t]
JavaScript code here...
[/code]
Oct 5 '07 #3
pbmods
5,821 Recognized Expert Expert
Heya, Bibhu.

What do you want your code to do? Give an example.
What is your code doing that you don't want it to do? Give an example.
What is your code *not* doing that it is supposed to? Give an example.
Oct 5 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1246
by: indie | last post by:
does anyone know how to make javascript for internet explorer in order that it can read the picture from my webcam or may be free code from website??. i'm using camserv to get streaming picture from my webcam. all browser can read the streaming picture from my webcam except Internet explorer. i'm using mandrake 9.2 as my operating system....
25
4270
by: Jeff | last post by:
Use the MS Script Editor included free with MS Office 2002 and above, for debugging Internet Explorer (IE). This subject is of great interest to many JS developers, as there is no obvious, low cost way to do sophisticated debugging in IE6 other than to use the debugger described below, which is horribly documented otherwise. I feel...
1
3498
by: Apu Nahasapeemapetilon | last post by:
Hello and thank you in advance for your help. Can anyone think of a reason why this code would work properly on one PC, but not another? I've got a System.Windows.Forms.UserControl that products events which I want to consume (sink) within Internet Explorer. I'm following the instructions at:...
2
2371
by: Water Cooler v2 | last post by:
How do you enable/disable JavaScript in Internet Explorer v6?
26
2249
by: Prisoner at War | last post by:
Hi, All: I have a JavaScript search engine that always causes MSIE 7 to do a top-of-page security "warning" (that top-of-page-bar, and not an "alert" )...but other websites' JavaScripts do not trigger that...what's going on? When I visit other JavaScript sites there's no warning and the scripts work fine, but mine (it's still under...
1
4817
by: avpkills2002 | last post by:
I seem to be getting this weird problem in Internet explorer. I have written a code for parsing a XML file and displaying the output. The code works perfectly fine with ffx(Firefox).However is not working in Internet Explorer.(I m using Internet Explorer 6.0). The code is as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
1
3255
by: miked13 | last post by:
I have 4 textfields labeled "qtyA","qtyB","qtyC" and "GrandTotal". I have my calculate() function run Onchange of any of the "qty" fields and it displays it in "GrandTotal". I am trying to get my code to work on browsers other than IE but I am at a loss with everything I have tried. function calculate() { totalcost =...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7619
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6290
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5228
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3662
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.