JavaScript - Run Javascript In Address Bar
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? Similar TutorialsHello. 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 hi, how can i get client mac address OR hdd id with javascript for internet explorer? Hey everyone. I need a little help and I'm not an expert by any stretch of the imagination with javascript. I have a simple little code script and I'd like either the onClick function (or the entire code itself, whichever is easiest) to only load once every 24 hours for each IP address. So "123.1.22.333" should only get the effect of this code once every 24 hours regardless if they revisit my site 5 times a day let's say. So here's my little script: Code: <script language="JavaScript"> function goNewWin() { TheNewWin=window.open("http://google.com",'Google','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1'); TheNewWin.blur(); } </script> <body onClick="goNewWin()"> Any help would be very appreciated. Thanks! Hi Friends, I am facing one problem that screw me left and right. Please share me if anyone of you faced this problem and solved already. I am using the below code to assign the javascript function on select on radio button. This may vary based on radio button selection. For some radio button selection the button will be disabled. if(yes) { document.getElementById("Name").href = "javaScript:functionA()"; document.getElementById("Name").onclick = "javaScript:functionA()"; }else { document.getElementById("Name").href = "#"; } This is the code i am using to activate the button or disable the button. For some causes i am getting "javaScript:functionA()" in the address bar instead of calling that java script method. So my new window is not showing me the correct result. Please some one advise me how to solve this problem. Thanks in advance. Regards, Jeva 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! AC_ActiveX.js & AC_RunActiveContent.js is for java app that detect my client mac address I have java application running on my computer. I've tested on several pc, sometimes it detect the mac address, but sometimes nothing came out. In create_users.php, somehow im not able to store the mac address into a variable..( var mac = getMacAddress(); ) 1) Are my java coding would run on every pc? 2) I'm able to print out the mac address with "document.write(getMacAddress());" but why isit having stored in the variable is an issue? 3) which explorer would be the best to have the java running? IE/FF/Opera? create_users.php PHP Code: <script src="Scripts/AC_ActiveX.js" type="text/javascript"></script> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> <!--[if !IE]> Firefox and others will use outer object --> <embed type="application/x-java-applet" name="macaddressapplet" width="0" height="0" code="MacAddressApplet" archive="macaddressapplet.jar" pluginspage="http://java.sun.com/javase/downloads/index.jsp" style="position:absolute; top:-1000px; left:-1000px;"> <noembed> <!--<![endif]--> <!----> <script type="text/javascript"> AC_AX_RunContent( 'classid','clsid:CAFEEFAC-0016-0000-FFFF-ABCDEFFEDCBA','type','application/x-java-applet','name','macaddressapplet','style','position:absolute; top:-1000px; left:-1000px;','code','MacAddressApplet','archive','macaddressapplet.jar','mayscript','true','scriptable','true','width','0','height','0' ); //end AC code </script><noscript><object classid="clsid:CAFEEFAC-0016-0000-FFFF-ABCDEFFEDCBA" type="application/x-java-applet" name="macaddressapplet" style="position:absolute; top:-1000px; left:-1000px;" > <param name="code" value="MacAddressApplet"> <param name="archive" value="macaddressapplet.jar" > <param name="mayscript" value="true"> <param name="scriptable" value="true"> <param name="width" value="0"> <param name="height" value="0"> </object></noscript> <!--[if !IE]> Firefox and others will use outer object --> </noembed> </embed> <script> function getMacAddress(){ document.macaddressapplet.setSep( "-" ); return (document.macaddressapplet.getMacAddress()); } var mac = getMacAddress(); </script> AC_ActiveX.js Code: function AC_AX_RunContent(){ var ret = AC_AX_GetArgs(arguments); AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs); } function AC_AX_GetArgs(args){ var ret = new Object(); ret.embedAttrs = new Object(); ret.params = new Object(); ret.objAttrs = new Object(); for (var i=0; i < args.length; i=i+2){ var currArg = args[i].toLowerCase(); switch (currArg){ case "pluginspage": case "type": ret.embedAttrs[args[i]] = args[i+1]; break; case "data": case "codebase": case "classid": case "id": case "onafterupdate": case "onbeforeupdate": case "onblur": case "oncellchange": case "onclick": case "ondblClick": case "ondrag": case "ondragend": case "ondragenter": case "ondragleave": case "ondragover": case "ondrop": case "onfinish": case "onfocus": case "onhelp": case "onmousedown": case "onmouseup": case "onmouseover": case "onmousemove": case "onmouseout": case "onkeypress": case "onkeydown": case "onkeyup": case "onload": case "onlosecapture": case "onpropertychange": case "onreadystatechange": case "onrowsdelete": case "onrowenter": case "onrowexit": case "onrowsinserted": case "onstart": case "onscroll": case "onbeforeeditfocus": case "onactivate": case "onbeforedeactivate": case "ondeactivate": ret.objAttrs[args[i]] = args[i+1]; break; case "width": case "height": case "align": case "vspace": case "hspace": case "class": case "title": case "accesskey": case "name": case "tabindex": ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1]; break; default: ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1]; } } return ret; } AC_RunActiveContent.js Code: var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; function ControlVersion() { var version; var axo; var e; // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry try { // version will be set for 7.X or greater players axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); version = axo.GetVariable("$version"); } catch (e) { } if (!version) { try { // version will be set for 6.X players only axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); // installed player is some revision of 6.0 // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29, // so we have to be careful. // default to the first public version version = "WIN 6,0,21,0"; // throws if AllowScripAccess does not exist (introduced in 6.0r47) axo.AllowScriptAccess = "always"; // safe to call for 6.0r47 or greater version = axo.GetVariable("$version"); } catch (e) { } } if (!version) { try { // version will be set for 4.X or 5.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = axo.GetVariable("$version"); } catch (e) { } } if (!version) { try { // version will be set for 3.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = "WIN 3,0,18,0"; } catch (e) { } } if (!version) { try { // version will be set for 2.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); version = "WIN 2,0,0,11"; } catch (e) { version = -1; } } return version; } // JavaScript helper required to detect Flash Player PlugIn version information function GetSwfVer(){ // NS/Opera version >= 3 check for Flash plugin in plugin array var flashVer = -1; if (navigator.plugins != null && navigator.plugins.length > 0) { if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; var descArray = flashDescription.split(" "); var tempArrayMajor = descArray[2].split("."); var versionMajor = tempArrayMajor[0]; var versionMinor = tempArrayMajor[1]; var versionRevision = descArray[3]; if (versionRevision == "") { versionRevision = descArray[4]; } if (versionRevision[0] == "d") { versionRevision = versionRevision.substring(1); } else if (versionRevision[0] == "r") { versionRevision = versionRevision.substring(1); if (versionRevision.indexOf("d") > 0) { versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")); } } var flashVer = versionMajor + "." + versionMinor + "." + versionRevision; } } // MSN/WebTV 2.6 supports Flash 4 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; // WebTV 2.5 supports Flash 3 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; // older WebTV supports Flash 2 else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; else if ( isIE && isWin && !isOpera ) { flashVer = ControlVersion(); } return flashVer; } // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) { versionStr = GetSwfVer(); if (versionStr == -1 ) { return false; } else if (versionStr != 0) { if(isIE && isWin && !isOpera) { // Given "WIN 2,0,0,11" tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] tempString = tempArray[1]; // "2,0,0,11" versionArray = tempString.split(","); // ['2', '0', '0', '11'] } else { versionArray = versionStr.split("."); } var versionMajor = versionArray[0]; var versionMinor = versionArray[1]; var versionRevision = versionArray[2]; // is the major.revision >= requested major.revision AND the minor version >= requested minor if (versionMajor > parseFloat(reqMajorVer)) { return true; } else if (versionMajor == parseFloat(reqMajorVer)) { if (versionMinor > parseFloat(reqMinorVer)) return true; else if (versionMinor == parseFloat(reqMinorVer)) { if (versionRevision >= parseFloat(reqRevision)) return true; } } return false; } } function AC_AddExtension(src, ext) { if (src.indexOf('?') != -1) return src.replace(/\?/, ext+'?'); else return src + ext; } function AC_Generateobj(objAttrs, params, embedAttrs) { var str = ''; if (isIE && isWin && !isOpera) { str += '<object '; for (var i in objAttrs) { str += i + '="' + objAttrs[i] + '" '; } str += '>'; for (var i in params) { str += '<param name="' + i + '" value="' + params[i] + '" /> '; } str += '</object>'; } else { str += '<embed '; for (var i in embedAttrs) { str += i + '="' + embedAttrs[i] + '" '; } str += '> </embed>'; } document.write(str); } function AC_FL_RunContent(){ var ret = AC_GetArgs ( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" , "application/x-shockwave-flash" ); AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs); } function AC_SW_RunContent(){ var ret = AC_GetArgs ( arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000" , null ); AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs); } function AC_GetArgs(args, ext, srcParamName, classid, mimeType){ var ret = new Object(); ret.embedAttrs = new Object(); ret.params = new Object(); ret.objAttrs = new Object(); for (var i=0; i < args.length; i=i+2){ var currArg = args[i].toLowerCase(); switch (currArg){ case "classid": break; case "pluginspage": ret.embedAttrs[args[i]] = args[i+1]; break; case "src": case "movie": args[i+1] = AC_AddExtension(args[i+1], ext); ret.embedAttrs["src"] = args[i+1]; ret.params[srcParamName] = args[i+1]; break; case "onafterupdate": case "onbeforeupdate": case "onblur": case "oncellchange": case "onclick": case "ondblClick": case "ondrag": case "ondragend": case "ondragenter": case "ondragleave": case "ondragover": case "ondrop": case "onfinish": case "onfocus": case "onhelp": case "onmousedown": case "onmouseup": case "onmouseover": case "onmousemove": case "onmouseout": case "onkeypress": case "onkeydown": case "onkeyup": case "onload": case "onlosecapture": case "onpropertychange": case "onreadystatechange": case "onrowsdelete": case "onrowenter": case "onrowexit": case "onrowsinserted": case "onstart": case "onscroll": case "onbeforeeditfocus": case "onactivate": case "onbeforedeactivate": case "ondeactivate": case "type": case "codebase": case "id": ret.objAttrs[args[i]] = args[i+1]; break; case "width": case "height": case "align": case "vspace": case "hspace": case "class": case "title": case "accesskey": case "name": case "tabindex": ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1]; break; default: ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1]; } } ret.objAttrs["classid"] = classid; if (mimeType) ret.embedAttrs["type"] = mimeType; return ret; } 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! Hi there, I would like to validate the email address typed into the prompt message by the user, but to no avail. Can some kind soul help? Code: function addOption() { var new = prompt("Enter New Item:"); if (!new == "") { var answer = confirm ("Are you sure you want to add? ") if (answer)//if answer is true { var lst = document.getElementById('lstBx'); // listbox control id // Now we need to create a new 'option' tag to add to MyListbox for (var i = 0; i < lst.options.length; i++) { arrTexts = lst.options[i].text; if (arrTexts.toLowerCase() == newItem.toLowerCase()) { alert ("That email address is already included in the list - please enter another one."); break; } else { validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i; strEmail = lst.value; // search email text for regular exp matches if (strEmail.search(validRegExp) == -1) { alert('A valid e-mail address is required.\nPlease retry.'); return false; } var optionNew = document.createElement("option"); optionNew.value = new; // The value that this option will have optionNew.innerHTML = new; // The displayed text inside of the <option> tags // Finally, add the new option to the listbox lst.appendChild(optionNew); //sort items in listbox in alpha order arrTexts = new Array(); for(i=0; i<lst.length; i++) { arrTexts[i] = lst.options[i].text; } arrTexts.sort(); for(i=0; i<lst.length; i++) { lst.options[i].text = arrTexts[i]; lst.options[i].value = arrTexts[i]; } } return false; } } } else { if(new == "") { alert("Key something to textbox please."); } else alert("Cancelled."); } } Code: <select id="lstBx" name="listBox" size="6" style="width: 580px;"> <option>a@hotmail.com</option> <option>b@hotmail.com</option> <option>c@yahoo.com</option> <option>d@gmail.com</option> <option>e@ymail.com</option> <option>f@msn.com</option> </select> hello everybody how can I set url in the address without opening the url , just placing ??? i.e : to open a url we use this PHP Code: document.location = 'http://www.codingforums.com/' I wanna show the user that the url is changing in the address bar as typing after it reached the end it will opens the url I don't care for the method of writing the new url in the address bar such as typing or sliding ... etc please tell me how to do this thanks Hi guys! I have tried numerous attempts in getting the Address field to work (i.e. validated). I want it to accept letters, numbers, spaces and commas! However, it won't let me! Below is the code I have provided. Code: function validateAddress(fld) { var error = ""; var illegalChars = /[\W_]/; // } else if (illegalChars.test(fld.value)) { fld.style.background = 'Yellow'; error = "Your Billing address contains illegal characters!\n"; } else { fld.style.background = 'White'; } return error; } Thanks a lot! I am trying to make an addition to a .js plugin for a wiki. Currently it does not support sorting my IP address. So far I have created the below code which does more than the script initially did, but is still not sorting 100% correctly. Any tips? Code: sort_ipaddr: function(a,b){ aa = a[0].split(".",4); bb = b[0].split(".",4); var counti = 0; for (var i=0; i<4; i++) { if (parseInt(parseFloat(aa[i])) == parseInt(parseFloat(bb[i]))){} if (parseInt(parseFloat(aa[i])) < parseInt(parseFloat(bb[i]))){counti--} if (parseInt(parseFloat(aa[i])) > parseInt(parseFloat(bb[i]))){counti++} } return counti; }, EDIT I've also tried this which is closer but still not there. Code: sort_ipaddr: function(a,b){ aa = a[0].split(".",4); bb = b[0].split(".",4); var resulta = (aa[3]+(aa[2]*256)+(aa[1]*256*256)+(aa[0]*256*256*256)); var resultb = (bb[3]+(bb[2]*256)+(bb[1]*256*256)+(bb[0]*256*256*256)); return resulta-resultb; }, This results in a list like so: 10.1.15.22 10.1.16.22 10.1.15.23 10.1.15.24 10.1.16.24 10.1.15.25 The below code works ok but need our help to get it perfect. I want the function to validate that after the "@" the user types "wendys.com". Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>New Page 1</title> <SCRIPT> function validateLP(theForm){ if(theForm.DM_Email){ var checkEmail =theForm.DM_Email.value; var invalidChars = " /:,;" if (checkEmail == "") { alert("Please enter a valid Wendys DM email address."); theForm.DM_Email.style.backgroundColor='#FFFF99'; theForm.DM_Email.focus(); return false; } if (checkEmail != "") { // can be empty for (i=0; i<invalidChars.length; i++) { // does it contain any invalid characters? var badChar = invalidChars.charAt(i) if (checkEmail.indexOf(badChar,0) > -1) { alert("Please enter a valid Wendys DM email address."); theForm.DM_Email.style.backgroundColor='#FFFF99'; theForm.DM_Email.focus(); return false; } } var periodPos1 =checkEmail.indexOf(".",1) // there must be one "." symbol var atPos = checkEmail.indexOf("@",periodPos1-1) // there must be one "." symbol before "@" var periodPos2 = checkEmail.indexOf(".",atPos) //periodPos2 = checkEmail.indexOf(".",atPos) if ( (atPos == -1) || (periodPos2 == -1)){ //return false alert("Please enter a valid Wendys DM email address."); theForm.DM_Email.style.backgroundColor='#FFFF99'; theForm.DM_Email.focus(); return false; } } } } </SCRIPT> </head> <body> <form method="POST" NAME="theForm" onSubmit="return validateLP(theForm)" action="--WEBBOT-SELF--"> <p><input type="text" name="DM_Email" size="20"></p> <p> </p> <p> </p> <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p> </form> </body> </html> I apologise if this is in the wrong section. I have built a website using iframes at: http://www.krillmeed.com/ but when clicking through the menu, the address bar still stays at http://www.krillmeed.com/ no matter which page is loaded into the iframe. I have seen a number of javascripts around that can change this, but most do not seem to work anymore. Has anyone a sure way to correct this please
Hi. I'm using the following script to allow a user to automatically fill some fields based on their previous entries. It works in FF, but doesn't work in IE. I'm not a js genie so hopefully one of you can help me out here. Thanks. js: Code: function shipsame(form){ if(form.sameasbilling.checked){ form.firstnameb.value = form.firstname.value; form.lastnameb.value = form.lastname.value; form.address1b.value = form.address1.value; form.address2b.value = form.address2.value; form.towncityb.value = form.towncity.value; form.stateb.value = form.state.value; form.zipcodeb.value = form.zipcode.value; }else{ form.firstnameb.value = ""; form.lastnameb.value = ""; form.address1b.value = ""; form.address2b.value = ""; form.towncityb.value = ""; form.stateb.value = ""; form.zipcodeb.value = ""; } } html: Code: <legend>Billing Address</legend> <ol> <li style="line-height:300%;"> <input type="checkbox" name="sameasbilling" value="yes" onClick="shipsame(this.form);"><span> Same as Shipping Address</span> </li> <li> <label for="firstnameb">First Name</label> <input id="firstnameb" name="firstnameb" value="<?php echo $cart->p_fnameb(); ?>" /> <script type="text/javascript"> var firstnameb = new LiveValidation('firstnameb'); firstnameb.add(Validate.Presence); </script> </li> Hi there, i really could use the help. Ok, so (and im sure i will be told other ways) i have come up with a way of blocking people from my site even if they are currently on the site and dont reload the page. What i was thinking of is simply: a tiny iframe on the bottom of my page, so small it cant be seen ie 1px that iframe goes to a page saying YOU HAVE BEEN BANNED That page istself will be on a constant 10 seccond refresh so as soon as i add the ip address to it, BOOM, it will break out of the iframe and take the user away from the main page as display the you have been banned message. Sound good? ok, so here is what i have sofar but i know its wrong, dont really know how to write it correctly. The main point is: if ip is 111.111.111 then break out of iframe else do nothing. Thanks for the help. Code: <script language="JavaScript"> VIH_ForeColor = "navy"; VIH_FontPix = "16"; VIH_DisplayFormat = "%%IP%%"; VIH_DisplayOnPage = "no"; </script> <script language="JavaScript" src="http://scripts.hashemian.com/js/visitorIPHOST.js.php"></script> <script language="JavaScript" src="http://scripts.hashemian.com/js/visitorIPHOST.js.php"></script> <script> if (VIH_HostIP == "111.111.111.111") document.write('if (top.location!= self.location) { top.location = self.location.href }' ); }else{ document.write(''); ;} </script> Hi there, i really could use the help. Ok, so (and im sure i will be told other ways) i have come up with a way of blocking people from my site even if they are currently on the site and dont reload the page. What i was thinking of is simply: a tiny iframe on the bottom of my page, so small it cant be seen ie 1px that iframe goes to a page saying YOU HAVE BEEN BANNED That page istself will be on a constant 10 seccond refresh so as soon as i add the ip address to it, BOOM, it will break out of the iframe and take the user away from the main page as display the you have been banned message. Sound good? ok, so here is what i have sofar but i know its wrong, dont really know how to write it correctly. The main point is: if ip is 111.111.111 then break out of iframe else do nothing. Thanks for the help. Code: <script language="JavaScript"> VIH_ForeColor = "navy"; VIH_FontPix = "16"; VIH_DisplayFormat = "%%IP%%"; VIH_DisplayOnPage = "no"; </script> <script language="JavaScript" src="http://scripts.hashemian.com/js/visitorIPHOST.js.php"></script> <script language="JavaScript" src="http://scripts.hashemian.com/js/visitorIPHOST.js.php"></script> <script> if (VIH_HostIP == "111.111.111.111") document.write('if (top.location!= self.location) { top.location = self.location.href }' ); }else{ document.write(''); ;} </script> I have this script to validate contact form fields. It works fine for checking that fields are not blank. I added the valid email code, which I copied from the w3schools web site. But, it does not work. I am confused about how to reference the email form field name. That is really the only thing I changed, that is, I added the frm.elements to the email variable. Can anyone please help? Thanks! Code: function validate_form(frm) { frm.elements.name.className = "input"; frm.elements.email.className = "input"; frm.elements.subject.className = "input"; frm.elements.comments.className = "input"; var errors=0; // // NAME cannot be blanks // if (isBlank(frm.elements.name.value)) { frm.elements.name.className = "inputreq"; errors++; } // // EMAIL ADDRESS cannot be blanks // if (isBlank(frm.elements.email.value)) { frm.elements.email.className = "inputreq"; errors++; } // // SUBJECT cannot be blanks // if (isBlank(frm.elements.subject.value)) { frm.elements.subject.className = "inputreq"; errors++; } // // COMMENTS cannot be blanks // if (isBlank(frm.elements.comments.value)) { frm.elements.comments.className = "inputreq"; errors++; } // // EMAIL ADDRESS appears invalid // if (validate_email(frm.elements.email.value,"Not a valid e-mail address!")==false) { alert("TEST"); frm.elements.email.focus(); return false; } // // Errors // if (errors>0) { alert("Please enter all fields!"); return false; } //No errors //frm.submit(); } function isBlank(value) { regexp = /^\s*$/ return (value==null || regexp.test(value)); } // Validate email address function validate_email(field,alerttxt) { with (field) { apos=value.indexOf("@"); dotpos=value.lastIndexOf("."); if (apos<1||dotpos-apos<2) {alert(alerttxt);return false;} else {return true;} } } Hi All, I am trying to create a script for checking that checks that the email address entered into two input boxes is the same when a submit button is clicked, I have these two input boxes Code: <input type="text" name="user_email" id="user_email" /> <input type="text" name="user_email2" id="user_email2" /> This javascript code Code: <script type="text/javascript"> var email1 = document.getElementById(user_email); var email2 = document.getElementById(user_email2); function checkEmail(){ if (email1 != email2) { alert("The two email addresses are not the same"); } } </script> and this code for the button Code: <input type="submit" name="submit" id="submit" onSubmit="checkEmail" /> However this code is not working, can anyone see where I am going wrong? Any help will be appreciated Thanks in advance Hi all I want to hide address bar for pop up window. I have used following script. In Linux machine its working fine. But in Windows machine address bar still displaying. I dont know whats the wrong. Please help me out. This is the code <script> function openNewWindow(url) { window.open (url,"",'width=620,height=300,scrollbars=yes,menubar=no,location=no'); } </script> <a href="javascript:void(0);" onclick="return openNewWindow('some url')">Click here</a> hi! i am doing a site using jquery address deep linking and within the content i need to implement a show/hide div function but it doesn't seems to be working. jquery address source: http://www.asual.com/jquery/address/ demo: http://www.asual.com/jquery/address/...tabs/#Overview my show/hide div: <a href="javascript:toggle('clickHere','here' true)">click here</a> <div id="here" style="visibility:hidden; display:none">xxxx</div> function toggle(target,imgname, isOn){ window.onresize = null; obj=document.getElementById(target); obj2=document.getElementById(imgname); if(isOn){ obj.style.visibility='hidden'; obj.style.display='none'; obj2.style.visibility='visible'; obj2.style.display='inline'; } else{ obj.style.visibility='visible'; obj.style.display='inline'; obj2.style.visibility='hidden'; obj2.style.display='none'; } } * the same set of show/hide codes work when the site is not implemented with jquery address (deep linking) * so what could be the issue here? please help! |