JavaScript - Run Javascript Code In Address Bar After Page Loaded
My source :
Code: <html> <head> <title></title> <script type="text/javascript"> function runcode(cwin) { cwin.location.replace("javascript:alert("Loaded complete")"); } function newtab() { win=window.open("http://www.google.com"); setTimeout("runcode(win)",5000); setTiemout("win.close()",7000); } </script> </head> <body> <input type="button" value="Click to open newtab" onclick="newtab()" /> </body> </html> I want after newtab is opened 5s, alert window will be opened with message:"Loaded complete". Then 2s it is closed. But it isn't what I expect. Please fix it for me. Thanks in advance! Similar TutorialsI am having problems calling a JS function from asp.net code behind button click after some code is ran. The first time the button is clicked and it calls the JSfunction the readyState = loading and it cannot find the element. The second time the button is clicked the readystate is complete and it finds the element. Anybody have any suggestions? Here is the code behind ClientScript.RegisterStartupScript(Me.GetType(), "CC", "<SCRIPT language='javascript'>parent.abc('button1')</SCRIPT>") and javascript function abc(src) { if (document.readyState == 'loading') { alert(document.readyState); } else { document.getElementById(src).click(); } } Let me give an example: javascript: var myvar=10; function myfunc(){}; void(0); After excuting the above js source code in the address bar of my browser, I can use window.myvar and window.myfunc() to access myvar and myfunc. This indicates that the above "address-bar javascript code" must have been stored somewhere in the current page. My question is: where is the "address-bar javascript code" stored in the current page? or equivalently, is it possible to retrieve the "address-bar javascript code" by using some other javascript codes? I checked document.childNodes and document.documentElement, but cannot find the javascript source code. Maybe the source code is stored in the window object? How to retrieve it? Thank you very much for the help! i have an iframe on my webpage and i am loading appropriate page in it by clicking appropriate button but when user logs out and at that time some page is opened in iframe corresponding to the login pages(like "edit profile") of user then at that moment i want to know that what page is loaded in iframe so that i close it(if it corresponds to pages of login like "edit profile") as user logs out and if it does not correspond to login pages then it remains as it is.For doing that i must know that what page is loaded in iframe and compare it in " if(condition){statement} in logout function" with the logion pages so that i know that if any of them is loaded in iframe and if loaded then close it.Can you help me with that by giving exact code example. Im running js to do some color coding in a table, i tried adding the onload but its not working, can someone take a look ? I need this to run when the entire page is fully loaded and not before. THE FUNCTION Code: var table1_column_settings = [ [32,40], // ito score - First column values more than 5 will be red, 2-5 will be yellow, less than 2 will be green [11,12], // schedule [14,15], // cost [11,12], // execution [9,10], // commercial [41,50] // total ]; // Loop through all cells in a table, coloring each one according to column-specific thresholds function color_cells(table, column_settings) { // How many rows are in the table? var num_rows = table.rows.length; // Loop through all rows. for (var r = 0; r < num_rows; r++) { // Get a reference to the current row. var this_row = table.rows[r]; // How many cells are in this row? var num_cells = this_row.cells.length; // Loop through all cells in this row. for (var c = 0; c < num_cells; c++) { // Get a reference to the cell. var this_cell = this_row.cells[c]; // Get the numerical value of the first (and only) node inside the cell. var cell_value = parseFloat(this_cell.firstChild.nodeValue); // If it's a number (literally if it's not not not-a-number) if (!isNaN(cell_value)) { // Apply the color according to the thresholds for this column number (c). if (cell_value > column_settings[c][1]) this_cell.style.backgroundColor= "red"; else if (cell_value > column_settings[c][0]) this_cell.style.backgroundColor= "yellow"; else this_cell.style.backgroundColor = "green"; } } } } EXECUTE THE FUNCTION Code: </TBODY> </table> <script> color_cells(document.getElementById("table1"), table1_column_settings);</script> //I TRIED LIKE THIS <script> window.onload=color_cells(document.getElementById("table1"), table1_column_settings);</script> AND IT DIDNT WORK Hi all, I am facing problem in preventing my web page being loaded into an iFrame. I search in internet and found this solution : if (self == top) document.documentElement.style.display = 'block'; else top.location = self.location; The above java script code is simple redirecting me to the home page of my web site. But I donot want that kind of solution. When anybody tried to access my web page through iFrame, it should show an error message like "The content of the web site cannot be loaded into an IFrame". This message should be displayed inside the iFrame. For example, if we tried to access "google.com" site in an iframe, the website should not allow the iframe object to load into it, insted it will display an error message along with a provision to open webiste with an external link with it. Any help? thanks, -Sanath Code: <div id="themenu" style="position:relative"> <script type="text/javascript" src="menu.js"> function Go(){return} Menu1=new Array("Home","","",0,20,133); Menu2=new Array("News","","",0,0,133); Menu3=new Array("Dressage","","",4,20,133); Menu3_1=new Array("Entry Form","","",0,20,133); Menu3_2=new Array("Results and League","","",0,20,133); Menu3_3=new Array("Diary Dates","","",0,20,133); Menu3_4=new Array("Times","","",0,27,133); Menu4=new Array("BHS Trec","","",1,0,133); Menu4_1=new Array("Entry Form","","",0,20,133); Menu5=new Array("Showjumping","","",1,0,133); Menu5_1=new Array("Results","","",0,20,133); Menu6=new Array("Horse Trials","","",0,20,133); Menu7=new Array("Help Days","","",0,20,133); Menu8=new Array("Membership","","",0,20,133); Menu9=new Array("Classified","","",0,20,133); Menu10=new Array("Payments","","",0,20,133); Menu11=new Array("What's On","","",0,20,102); var NoOffFirstLineMenus=11; var LowBgColor='#0F228B'; var LowSubBgColor='#0F228B';var HighBgColor='#0F228B'; var HighSubBgColor='#0F228B'; var FontLowColor='#FFFF00'; var FontSubLowColor='#FFFF00';var FontHighColor='#FFCC00'; var FontSubHighColor='#FFCC00';var BorderColor='#0F228B'; var BorderSubColor='#0F228B'; var BorderWidth=3; var BorderBtwnElmnts=0; var FontFamily="Tahoma, Verdana, Arial" var FontSize=10; var FontBold=0; var FontItalic=1; var MenuTextCentered='center'; var MenuCentered='left';var MenuVerticalCentered='top'; var ChildOverlap=.2; var ChildVerticalOverlap=.2; var StartTop=3; var StartLeft=28; var VerCorrect=0; var HorCorrect=0; var LeftPaddng=3; var TopPaddng=6; var FirstLineHorizontal=0; var MenuFramesVertical=1; var DissapearDelay=1000; var TakeOverBgColor=1; var FirstLineFrame='navig'; var SecLineFrame='space'; var DocTargetFrame='space'; var TargetLoc='themenu'; var HideTop=0; var MenuWrap=1; var RightToLeft=0; var UnfoldsOnClick=0; var WebMasterCheck=0; var ShowArrow=0; var KeepHilite=1;var Arrws=['tri.gif',5,10,'tridown.gif',10,5,'trileft.gif',5,10]; var AgntUsr=navigator.userAgent.toLowerCase();var DomYes=document.getElementById?1:0;var NavYes=AgntUsr.indexOf('mozilla')!=-1&&AgntUsr.indexOf('msie')==-1?1:0;var ExpYes=AgntUsr.indexOf('msie')!=-1?1:0;var Opr=AgntUsr.indexOf('opera')!=-1?1:0;var Opr6orless=window.opera && navigator.userAgent.search(/opera.[1-6]/i)!=-1 f ( Opr6orless!=1 ) { ExpYes = 1 }var DomNav=DomYes&&NavYes?1:0;var DomExp=DomYes&&ExpYes?1:0;var Nav4=NavYes&&!DomYes&&document.layers?1:0;var Exp4=ExpYes&&!DomYes&&document.all?1:0;var PosStrt=(NavYes||ExpYes)&&!Opr6orless?1:0;var FrstLoc,ScLoc,DcLoc;var ScWinWdth,ScWinHght,FrstWinWdth,FrstWinHght;var ScLdAgainWin;var FirstColPos,SecColPos,DocColPos;var RcrsLvl=0;var FrstCreat=1,Loadd=0,Creatd=0,IniFlg,AcrssFrms=1;var FrstCntnr=null,CurrntOvr=null,CloseTmr=null;var CntrTxt,TxtClose,ImgStr;var Ztop=100;var ShwFlg=0;var M_StrtTp=StartTop,M_StrtLft=StartLeft;var StaticPos=0; var LftXtra=DomNav||DomExp&&!Exp4&&!Opr6orless?LeftPaddng:0; var TpXtra=DomNav||DomExp?TopPaddng:0; var M_Hide=Nav4?'hide':'hidden'; var M_Show=Nav4?'show':'visible'; var Par=parent.frames[0]&&FirstLineFrame!=SecLineFrame?parent:window; var Doc=Par.document; var Bod=Doc.body; var Trigger=NavYes&&!Opr?Par:Opr?Doc:Bod; MenuTextCentered=MenuTextCentered==1||MenuTextCentered=='center'?'center':MenuTextCentered==0||MenuTextCentered!='right'?'left':'right'; WbMstrAlrts=["Item not defined: ","Item needs height: ","Item needs width: "]; if(Trigger.onload)Dummy=Trigger.onload; if(DomNav||Opr)Trigger.addEventListener('load',Go,false); else Trigger.onload=Go; function Dummy(){return} function CnclSlct(){return false} function RePos(){ FrstWinWdth=ExpYes?FrstLoc.document.body.clientWidth:FrstLoc.innerWidth; FrstWinHght=ExpYes?FrstLoc.document.body.clientHeight:FrstLoc.innerHeight; ScWinWdth=ExpYes?ScLoc.document.body.clientWidth:ScLoc.innerWidth; ScWinHght=ExpYes?ScLoc.document.body.clientHeight:ScLoc.innerHeight; if(MenuCentered=='justify'&&FirstLineHorizontal){ FrstCntnr.style.width=FrstWinWdth+'px';ClcJus(); var P=FrstCntnr.FrstMbr,W=Menu1[5],i; for(i=0;i<NoOffFirstLineMenus;i++){P.style.width=W+'px';P=P.PrvMbr}} StaticPos=-1; if(TargetLoc)ClcTrgt(); if(MenuCentered)ClcLft(); if(MenuVerticalCentered)ClcTp(); PosMenu(FrstCntnr,StartTop,StartLeft)} function UnLoaded(){ if(CloseTmr)clearTimeout(CloseTmr); Loadd=0; Creatd=0; if(HideTop){ var FCStyle=Nav4?FrstCntnr:FrstCntnr.style; FCStyle.visibility=M_Hide}} function ReDoWhole(){ if(ScWinWdth!=ScLoc.innerWidth||ScWinHght!=ScLoc.innerHeight||FrstWinWdth!=FrstLoc.innerWidth||FrstWinHght!=FrstLoc.innerHeight)Doc.location.reload()} function Check(WMnu,NoOf){ var i,array,ArrayLoc; ArrayLoc=parent.frames[0]?parent.frames[FirstLineFrame]:self; for(i=0;i<NoOf;i++){ array=WMnu+eval(i+1); if(!ArrayLoc[array]){WbMstrAlrt(0,array); return false} if(i==0){ if(!ArrayLoc[array][4]){WbMstrAlrt(1,array); return false} if(!ArrayLoc[array][5]){WbMstrAlrt(2,array); return false}} if(ArrayLoc[array][3])if(!Check(array+'_',ArrayLoc[array][3])) return false} return true} function WbMstrAlrt(No,Xtra){ return confirm(WbMstrAlrts[No]+Xtra+' ')} Im very new to java scripting so any help would be truly appreciated. I have a single web page that loads several iframes. One of the iframe pages has to be logged in first. I have that taken care of but once the page is loaded I need to change the source to a link with in the page. My guess is I need something to execute the code like a onload or something. This is what Ive been trying to get to work but like I said a newb! The iframe in question is named "cad" the initial source once loaded is 'https://urlname.com/mainmenu.asp' the source I need to change to is 'https://urlname.com/UnitStatusF.asp?agency_id=28' [CODE] function ChangesSrc() { var iframeid = document.getElementById(cad); var unitstatus = 'https://urlname.com/UnitStatusF.asp?agency_id=28' if (iframeid.src = 'https://urlname.com/mainmenu.asp') iframeid.src = unitstaus; return false; } [[CODE] The project I am working on involves a flash piece that communicates with a iframe. Currently the flash piece just calls on javascript functions. I want the buttons in the flash piece to be able to change the src of the iframe. PHP Code: <script type="text/javascript"> document.getElementById('video').setAttribute('src',address2); function closeVideo() { document.getElementById('video').style.height='0px'; return false; document.getElementById('video').setAttribute('src', address2); } function openVideo() { document.getElementById('video').style.height='391px'; return false; document.getElementById('video').setAttribute('src', address); } </script> So the way the code works now is when the page loads it sets the iframe with the id of 'video' to the variable address2 which it pulls from an XML file. In the flash piece when a button is hit, it calls openVideo() which "opens" the iframe and I want it to change the contents to address. This does not work though. It opens the frame but will not change the src. I've tried a bunch of different things now such as make the flash target the iframe using navigateToURL(request1, 'video'); but in Firefox and IE is opens it stills as if I had _blank in there. It does strangely work in Safari. Any ideas how to get this to work? I'm new to javascript so it could be something basic I'm overlooking Hi, I have a site that runs a javascript slideshow automatically when a user visits it. It is designed in such a way that I cannot pre-load individual images for aesthetic reasons. (Also the whole concept makes my brain hurt.) I therefore need 1 of 2 things: 1. A preloader that doesn't show the page or start the slideshow until all the images are loaded. or 2. I could start with the slideshow paused, and when the page is fully loaded, the play command (currently attached to a 'play' button) is 'sent'. (I'm not techy, so this is the best I can do as explanation.) The latter would probably be more elegant, especially if ultimately I could hide the controls for the slideshow with a loading bar until all the html is loaded, and then show them when the slideshow starts. I'm sorry if this is a really basic question. I tried searching the site but couldn't find anything. If you do feel like answering, can you imagine that you are speaking to a 5 year old. Then dumb it down a bit. I need all the explanation and clarity I can get! Thanks! hi, on my page: here the logos are greyscale but when the page is loading they flash up in colour?! could this be avoided and hidden? here is my Javascript o apply greyscale to my logos Code: $(window).load(function(){ // On window load. This waits until images have loaded which is essential // Fade in images so there isn't a color "pop" document load and then on window load $("#our-work img").animate({opacity:1},500); // clone image $('#our-work img').each(function(){ var el = $(this); el.css({"position":"absolute"}).wrap("<div class='img_wrapper' style='display: inline-block'>").clone().addClass('img_grayscale').css({"position":"absolute","z-index":"998","opacity":"0","margin-left":"64px;"}).insertBefore(el).queue(function(){ var el = $(this); el.parent().css({"width":this.width,"height":this.height}); el.dequeue(); }); this.src = grayscale(this.src); }); // Fade image $('#our-work img').mouseover(function(){ $(this).parent().find('img:first').stop().animate({opacity:1}, 1000); }) $('.img_grayscale').mouseout(function(){ $(this).stop().animate({opacity:0}, 1000); }); }); // Grayscale w canvas method function grayscale(src){ var canvas = document.createElement('canvas'); var ctx = canvas.getContext('2d'); var imgObj = new Image(); imgObj.src = src; canvas.width = imgObj.width; canvas.height = imgObj.height; ctx.drawImage(imgObj, 0, 0); var imgPixels = ctx.getImageData(0, 0, canvas.width, canvas.height); for(var y = 0; y < imgPixels.height; y++){ for(var x = 0; x < imgPixels.width; x++){ var i = (y * 4) * imgPixels.width + x * 4; var avg = (imgPixels.data[i] + imgPixels.data[i + 1] + imgPixels.data[i + 2]) / 3; imgPixels.data[i] = avg; imgPixels.data[i + 1] = avg; imgPixels.data[i + 2] = avg; } } ctx.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height); return canvas.toDataURL(); } I have a form with three fields. When the user changes the value of field1, the form displays either field2 or field3. This works fine for NEW records. However, I'm running into a problem when trying to EDIT an existing record. When the form is loaded, I need to test the value of field1 and display either field2 or field3. I've tried using the form onload event, but do not know how to access the value of field1. I'm using Javascript and div tags. This is what I have so far. <script type="text/javascript"> function hide(obj) obj1 = document.getElementById(obj); obj1.style.display = 'none'; } function show(obj) { obj1 = document.getElementById(obj); obj1.style.display = 'block'; } function show_other(optionValue) { if(optionValue=='C') { show('divClass');} else{hide('divClass'); } if(optionValue=='W') { show('divWorkshop');} else{hide('divWorkshop'); } } </script> /* Field1 - is a drop down list */ <select name="ClassType" size="1" onchange="show_other(this.value)"> ... </select> /* Field2 */ <div id="divClass"> ... </div> /* Field 3 */ <div id="divWorkshop"> ... </div> Appreciate any assistance. Thanks Peter Can a random page be loaded without a prior visit to a site? I have a list of 15 people with a photo and contact information in a table with 3 columns and 5 rows. The issue is that the people near the bottom want a chance to be at the top the first time the page is viewed. It is unlikely that a second visit would happen. Is this possible to load a random page for a site without it being viewed or logged into before, therefore no cookies will be used. My knowledge of Java script code is limited so any help would be great. Thanks Motty I doubt this is possible, but I have no idea what actually happens when a page loads, so I thought I would give it a shot... if a js file that is loaded externally has parameters, is it possible to turn those parameters into variables, giving the user the option to select the variable's value after the page has loaded? maybe a concrete example would be better... in google maps, the api is loaded like this: Code: <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> but if you wanted to specify that you want the api to function in Spanish, you load it like this: Code: <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=es"></script> and that language=es is the one that I want to change. But I can't seem to make it into a variable on page load, like this: Code: <script type="text/javascript"> var lang="es"; </script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=lang"></script> much less make it changeable once the page has loaded. I have a feeling that this is a really dumb question, but can it be done without reloading the entire page? Hi, ive been asked to make a blackjack game in javascript but I have a little bit of a problem. When the page loads, it deals cards to the player and the dealer, showing which cards have been dealt and the current scores. When I press the HIT button, i need to add another card to the array player_hand_img, and the value of this card to player_hand. I have successfully created this code, but my question is, how do I update the information (the score and the cards) on the screen after it has loaded? Can you do this in JavaScript or do I need another language? Thanks very much in advance! I've been fooling around with developing an IETMs interface (Interactive Electronic Technical Manual - like an interactive parts catalogue) to display the data live from an existing Access database. The idea is to be able to run this interface on a network hosted intranet with straight HTML, plain Javascript, VBScript & ActiveX objects, so that it doesn't require IIS etc to run ASP or PHP etc (I don't want to involve corporate IT for the IIS). All is going pretty well, & I'm impressed with the setup except for a few minor things - checking if a frame is loaded, & global variables. My setup is a HTML page hosting 5 frames with each containing an empty <DIV> (which gets the page written to it dynamically), but I need to ensure all frames are loaded before getting into the heavy stuff (which Javascript is handling brilliantly!). But I'm finding that Javascript sux at truly detecting if a frame is loaded (someone please prove me wrong!). I have all 5 frames call a function fnInitialiseIfReady(), then if I could either successfully test if all frames are loaded, or if I could globally count if this function has been called 5 times, I can proceed with confidence & call my function fnInitialise(). But unfortunately neither is working for me. From tireless internet searches, I've tried the 'frames always load in order' theory, & that is simply not correct. I have set up a test with the frames calling a function passing their name as a parameter, & each time the frames load in a different order every time. It is totally random. Note: I proved this by having the first 4 frames call a certain function(which contains an alert() line showing the frame name parameter passed), & having the last frame call a different function (which contains an alert("all are loaded!") line). The "all are loaded!" does not always appear last. I've also tried the '.frames["FrameName"].document.loaded' approach, & it ALWAYS returns 'undefined' for every frame. Am I doing something wrong here? I've also tried the '.frames["FrameName"].window.location.href' approach & it ALWAYS returns the html filename regardless of whether that page has loaded or not, so it is not an indicator of loading completion. I've also tried the '.frames["FrameName"].document.location' approach & it's ALWAYS the same as the '.window.location.href' approach. Also, I'm finding Javascript will not hold global variables for me at all. I don't know if it's a combination of multiple frames & using Javascript & VBScript together, but global variables just do not hold a value at all. Local variables (within functions) are fine. Any ideas? I don't have many globals, so I'm thinking of using a cookie. A valid Solution? BTW, the reason for also using VBScript is that it accesses the ActiveX controls by default, & being a corporate intranet app I can guarantee MSIE usage. It's frustrating because if I can solve these 2 relatively minor issues, then I'm super impressed with the robustness of this Javascript/VBScript approach. By leveraging each of their strengths, it's crunching the data just as quickly as the VB, C#, & C++ programs I've written for this particular dataset. I'm impressed! Thanks in advance, Dave Lock. Hi, I have a jsp which has a function gets called during the page unload. This jsp has a form with an action attribute to one servlet. Please find below the code snippet. ---- Java script code --- function logoff() { document.forms["FormName"].rel="nofollow" target="_self"; alert('Submitting the form'); document.forms["FormName"].submit(); } --- HTML form code ----- <body onUnload='logOff()'> <form name ="FormName" method="POST" action='<%=sLogoutResponseURL %>'> Whenever the page gets unloaded always logoff function is getting called. I also get the alert message "Submitting the form". But my servrlet does not get invoked. My application supports logging in with the same user id more than once. Scenario it works: User logs in. Close the application. logoff function is called and servlet gets invoked. Scenario it does not work: User logs in one window. Open one more IE window and and open the application with same user id. this can be repeated. Now when i close the application logoff function is called for all of the window close. But servlet does not gets invoked all the time. Sometimes it stops calling servlet. I have searched over the net and found one solution. Below piece of code will make sure form gets always submitted. -------------------------Start ----------------- function fakeSubmit(event) { var target = event ? event.target : this; /* Fire a submit event */ var fakeEvent = $(target).fire("form:submit"); if (fakeEvent.stopped == false) { /* Call the real submit function */ this._submit(); } } if(window.HTMLElement){ /* DOM-compliant Browsers */ HTMLFormElement.prototype._submit = HTMLFormElement.prototype.submit; HTMLFormElement.prototype.submit = fakeSubmit; } else { /* IE does not expose it's HTMLElement object or its children Let the document load so all forms are accounted for */ document.observe("dom:loaded", function(){ for(var i = 0; i < document.forms.length; i ){ document.forms[i]._submit = document.forms[i].submit; document.forms[i].submit = fakeSubmit; } }); } -----------End ------------------ But this resulted in script error while loading the page "object does not support this method or property" at line where document.observe is there. Kindly help at the earliest. Thanks in advance Santosh I want to know how can i make javascript that i can use by run into in address bar.. I just need such javascript that run through address bar. My purpose is How can i check all check box in webpage that do not include all check or uncheck button? Best common example for check all or uncheck all is Quote: <html> <head> <title>Check All</title> <SCRIPT LANGUAGE="JavaScript"> function checkall(formid) { len=formid.ckb.length for(i=0;i<len;i++) { formid.elements.ckb[i].checked=true } } function uncheckall(formid) { len=formid.ckb.length for(i=0;i<len;i++) { formid.elements.ckb[i].checked=false } } </SCRIPT> </head> <body> <CENTER> <FORM NAME="myform"> <INPUT TYPE="checkbox" NAME="ckb"> Checkbox One <BR> <INPUT TYPE="checkbox" NAME="ckb"> Checkbox Two <BR> <INPUT TYPE="checkbox" NAME="ckb"> Checkbox Three <BR> <INPUT TYPE="button" NAME="chka" VALUE="Check All" onClick="checkall(this.form)"> <INPUT TYPE="button" NAME="unchka" VALUE="Uncheck All" onClick="uncheckall(this.form)"> </FORM> </CENTER> </body> </html> Now for above code If there would not have any javascript for select all then how can i use the select all javascript that i can run through address bar. i.e how can i just check all check box by using javascript? I'm facing an issue with fetching the page URL from an IFRAME with cross domain. Is there any approach/ any ways to achieve this? hi, how can i get client mac address OR hdd id with javascript for internet explorer? Hello. Is the any chance to increment IP address in Javascript ? For example 11.12.13.14 plus 1 will be 11.12.13.15 I've started to modify my old script: Code: var ipa = 10.11.12.13; var partsa = []; var tempa = ipa; for ( var p = 0; p < 3; ++p ) { var dot1t = tempa.indexOf("."); partsa[p] = tempa.substring(0,dot1t); tempa = tempa.substring(dot1t+1); } partsa[3] = tempa; But do not know how to display ip like: ( parts1[0].parts1[1].parts1[2].parts1[3]+1 ) Please help. Leos |