JavaScript - Validation Redirection Error
I'm facing a validation error, whenever I leave any of the fields blank, it gives me a warning and then it redirects me to (index.php?option=com_ccnewsletter&view=ccnewsletter)
What I wanna know is how can I freeze the page until all fields are filled? This is the javascript code: Code: <script type="text/javascript"> function formsubmit(task) { var form = document.subscribeFormModule; if(task == "addSubscriber") { if(form.name.value== "") { alert('<?php echo $parameters['namewarning']; ?>'); } else if(form.email.value == "") { alert('<?php echo $parameters['emailwarning']; ?>'); } else if(( form.email.value.search("@") == -1) || ( form.email.value.search("[.*]" ) == -1 )) { alert('<?php echo $parameters['emailwarning']; ?>'); } <?php if($parameters['showterm']) { ?> else if(form.terms_condition_ch.checked == false) { alert ('<?php echo $parameters['terms_cond_warn']; ?>'); } <?php } ?> else { form.task.value = "addSubscriber"; form.submit(); } } else if(task == "removeSubscriberByEmail") { if(form.email.value == "") { alert('<?php echo $parameters['emailwarning']; ?>'); } else if(( form.email.value.search("@") == -1) || ( form.email.value.search("[.*]" ) == -1 )) { alert('<?php echo $parameters['emailwarning']; ?>'); } else { form.task.value = "removeSubscriberByEmail"; form.submit(); } } } </script> And this is the form's code: Code: <div class="mainnewsletter"> <p><?php echo $parameters['introduction'] ?></p> <div class="module" style="padding-top: 0px;"> <div class="normalsublayout"> <form class="form-login" action="<?php echo JRoute::_('index.php?option=com_ccnewsletter&view=ccnewsletter');?>" method="post" name="subscribeFormModule" id="subscribeFormModule"> <p><div> <?php echo $parameters['name']; ?>: <div class="username-block"> <div class="input-field-l"> <input class="inputbox" type="text" onblur="if(this.value=='') this.value='YourName';" onfocus="if(this.value=='YourName') this.value='';" name="name" id="name" value="<?php echo $name; ?>" /> </div></div> </div> </p> <p> <div> <?php echo $parameters['email']; ?>: <div class="password-block"> <div class="input-field-l"> <input class="inputbox" type="text" onblur="if(this.value=='') this.value='youremail@domain.com';" onfocus="if(this.value=='youremail@domain.com') this.value='';" name="email" id="email" size="15" maxlength="35" value="<?php echo $email; ?>" /> </div> </div> </div> </p> <?php if($parameters['showterm']) { ?> <p> <input id="ccnewsletter" name="terms_condition_ch" class="inputbox" type="checkbox"> <a style="font-size:14px;color:#4E4E51; display: margin:0px 0px 0px 5px;text-decoration:none;" href='<?php echo $cid; ?>' class="modal" rel="{handler: 'iframe', size: {x: 700, y: 375}}"><?php echo $terms;?></a> </p> <?php } if($unsubscribe) { ?> <p> <input class="button" type="submit" id="addSubscriber" name="addSubscriber" value="<?php echo $parameters['subscribe']; ?>" onclick="formsubmit('addSubscriber');"/> </p> <p><input class="button" type="submit" id="removeSubscriberByEmail" name="removeSubscriberByEmail" value="<?php echo $parameters['unsubscribe']; ?>" onclick="formsubmit('removeSubscriberByEmail');"/> </p> <?php } else { ?><div class="readon-wrap1"> <div class="readon1-l"></div> <span class="readon-main"><span class="readon1-m"><span class="readon1-r"><input class="button" type="submit" id="addSubscriber" name="addSubscriber" value="<?php echo $parameters['subscribe']; ?>" onclick="formsubmit('addSubscriber');"/></span></span></span></div> <!--<p><center><input type="image" src="images/back_f2.png" id="addSubscriber" name="addSubscriber" value="<?php echo $parameters['subscribe']; ?>" onclick="formsubmit('addSubscriber');"/></center></p>--> <?php } ?> <input type="hidden" name="option" value="com_ccnewsletter" /> <!--<input type="hidden" name="task" value="addSubscriber" />--> <input type="hidden" name="task" value="" /> </form> </div> </div></div> I don't know, maybe I'm missing something because it was working fine a before. Similar Tutorialsi have following code for edit news Code: <%@ Language="VBScript" %> <% Option Explicit %> <html> <head><title>News Management System - Update News</title> <script type="text/javascript"> <!-- var dtCh= "/"; var minYear=1900; var maxYear=2100; var EDate = (Date()); var endDate = Date.parse(EDate); endDate = endDate - 86400000 function isInteger(s){ var i; for (i = 0; i < s.length; i++){ // Check that current character is number. var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // All characters are numbers. return true; } function stripCharsInBag(s, bag){ var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function daysInFebruary (year){ // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 ); } function DaysArray(n) { for (var i = 1; i <= n; i++) { this[i] = 31 if (i==4 || i==6 || i==9 || i==11) {this[i] = 30} if (i==2) {this[i] = 29} } return this } function isDate(dtStr){ var daysInMonth = DaysArray(12) var pos1=dtStr.indexOf(dtCh) var pos2=dtStr.indexOf(dtCh,pos1+1) var strMonth=dtStr.substring(0,pos1) var strDay=dtStr.substring(pos1+1,pos2) var strYear=dtStr.substring(pos2+1) strYr=strYear if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1) if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1) for (var i = 1; i <= 3; i++) { if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1) } month=parseInt(strMonth) day=parseInt(strDay) year=parseInt(strYr) if (pos1==-1 || pos2==-1){ return "The date format should be : mm/dd/yyyy"; } if (strMonth.length<1 || month<1 || month>12){ return "Please enter a valid month"; } if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){ return "Please enter a valid day"; } if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){ return "Please enter a valid 4 digit year between "+minYear+" and "+maxYear; } if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){ return "Please enter a valid date"; } return ''; } //--> </script> <script type="text/javascript"> function Submitme() { var _message=''; var _errorEarlier=false; if(document.frm.newstitle.value == "") { _errorEarlier = true; _message = 'Please enter news title'; } if(document.frm.newsbody.value == "") { if (_errorEarlier){_message += "\r\nPlease enter news detail";} else{_errorEarlier = true;_message = "Please enter news detail";} } if(document.frm.newsdate.value == "") { if (_errorEarlier){_message += "\r\nPlease todays or future date";} else{_errorEarlier = true;_message = "Please todays or future date";} } var dt=document.frm.newsdate var SDate = frm.newsdate.value; var FormDate = Date.parse(SDate); var dateError = isDate(dt.value); if (dateError != ''){ if (_errorEarlier){_message += "\r\n" + dateError;} else{_errorEarlier = true;_message = dateError;} } else if(FormDate < endDate ) { if (_errorEarlier){_message += "\r\nPlease ensure that the Entered Date is greater than or equal to the Todays Date.";} else{_errorEarlier = true;_message = "Please ensure that the Entered Date is greater than or equal to the Todays Date.";} } if (_errorEarlier) { alert(_message);return false; } else { document.frm.action="update_record.asp"; document.frm.submit(); } } </script> <script type="text/javascript"> <!-- function isAlpha(keyCode) { if(keyCode==16) isShift = True; var res = ((keyCode >= 65 && keyCode <= 90) || keyCode == 8 || keyCode == 32) if (!res) document.getElementById("lblAlpha").style.visibility = "visible"; else document.getElementById("lblAlpha").style.visibility = "hidden"; return res; } //--> </script> </head> <body> <% 'declare you variables Dim SQL, connection, recordset,newstitle,newsbody,newsdate Dim sConnString, ID 'receive the id of the record passed through querystring ID=request.querystring("ID") 'Declare the SQL statement that will query the database SQL="SELECT * FROM latestNews WHERE ID=" & ID 'Create an ADO connection and recordset object Set Connection = Server.CreateObject("ADODB.Connection") Set Recordset = Server.CreateObject("ADODB.Recordset") 'define the connection string, specify database 'driver and the location of database sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & Server.MapPath("news_data.mdb") 'Open the connection to our database Connection.Open(sConnString) 'Open the recordset object, execute the SQL statement 'and return the record with the id that was sent recordset.Open SQL,connection %> <div align='center'> <table width="370" border="0" cellspacing="0" cellpadding="0" align="center"> <tr align="left" valign="top"> <td> <div align="center"> <p> </p> <!-- start the html form --> <form method="post" action="update_record.asp" name="form"> <input type="hidden" name="id" value="<%= recordset("id")%>"> <table border="2" bordercolor="#CCCCFF" cellspacing="0" cellpadding="4"> <tr> <td> News Title</td> <td> <input id="txtAlpha" type="text" name="newstitle" value="<%= recordset("newstitle")%>" size="50" class="cssborder" onkeyup="keyUP(event.keyCode)" onkeydown="return isAlpha(event.keyCode);" onpaste="return false;" /> </td> <td> <span id="lblAlpha" style="color: Red; font-size: 10pt; font-family: Arial; visibility: hidden;"> * Only Alphabets</span> </td> </tr> <tr> <td valign="top"> News Text</td> <td> <textarea cols="50" rows="8" name="newsbody" class="cssborder"><%= recordset("newsbody")%></textarea></td> </tr> <tr> <td> News Date</td> <td> <input type="text" name="newsdate" value="<%= recordset("newsdate")%>" size="12" class="cssborder"><font color="#CC0000">(mm/dd/yyyy)</font></td> </tr> <tr> <td colspan="2"> <input type="hidden" name="id" value="<%=id%>"> <input type="hidden" name="ispostback" value="1"> <input type="submit" value="update" class="cssborder" onclick="return Submitme();" /> </table> <br> <br> </form> <!-- end the html form --> </div> </td> </tr> </table> </div> <% 'close the connection and recordset objects recordset.Close Set recordset=Nothing connection.Close Set connection=Nothing %> </body> </html> but when i leave blank all fields it cannot check them. and submit the form without displaying any error. wht wrong in this code?? this is how i call the editor: Code: <!-- editor --> <? include "js/editor/buttons.php"; ?> <iframe id="textbox" class="Eddietor" src="js/editor/editor.php"></iframe><br /> <input type="hidden" id="content" name="content"> <!-- /editor --> and this is editor.js: Code: window.onload = function() { Editor = document.getElementById('textbox').contentWindow.document; Editor.designMode = "on"; document.forms[0].onsubmit = function() { var text = document.getElementById('text'); text.value = Editor.body.innerHTML; } } function doColor(colour) { document.getElementById("textbox").contentWindow.focus(); document.getElementById("textbox").contentWindow.document.execCommand("forecolor",false, colour); } function doClick(command) { document.getElementById("textbox").contentWindow.focus(); document.getElementById("textbox").contentWindow.document.execCommand(command, false, null); } function doLink() { var mylink = prompt("URL:", "http://"); if ((mylink != null) && (mylink != "")) { document.getElementById("textbox").contentWindow.focus(); document.getElementById('textbox').contentWindow.document.execCommand("CreateLink",false,mylink); } } function doImage() { myimg = prompt('URL:', 'http://'); document.getElementById("textbox").contentWindow.focus(); document.getElementById('textbox').contentWindow.document.execCommand("InsertImage", false, myimg); } another script i made is having problems with the ID="textbox" , it might be fixed if i change id and start using name="textbox" instead, but i don't know how to do this in js. need to edit the editor.js and change id="textbox"->to->name="textbox" can anyone help me? i got no idea how to use the getElementByName thingie , i'm trying to do this for 4 hours already and still no go. appreciated. Hi Folks, I'm new here, as well as to JavaScript, and am stuck. I'm trying to get something to validate using the W3C file validation, and I'm stuck. This is XHTML 1.0 Strick, and I know that isn't JS, but since the error involved JS I posted it here. If I would be better putting it in HTML please let me know. Everything works fine on the page, but I keep getting one single error. The > in Red is what shows up as the issue. Do ya'll see something glaringly obvious that I did wrong? Thanks for the help! Code: document.write("<a href='mailto:" + emLink + "' > "); You may not beable to help but I could not find any where else.. I am getting this error when i submit my form without the email address.. Attribute validation error for tag CFMAIL. The value of the attribute FROM is invalid. The length of the string, 0 character(s), must be greater than or equal to 1 character(s). The error occurred in \\NAWINFS02\home\users\web\b153\rh.chadwickorchids\name\name.cfm: line 2 1 : <cfmail 2 : from="#form.visitor_email#" 3 : to="orders@chadwickorchids.com;#form.visitor_email#" 4 : subject="Chadwick Orchids Name Your Own Orchid" How can I have this script go back to the form if it generates a error instead of going to the coldfussion error? please help Hello, Am new to this forum, as you can see this is my first post. Am having problem in validating my form, so i like you guys to help me out. Code: <html> <head> <title>Javascript form Validation</title> <script language="javascript"> <!-- function formValid() { var user = ducument.getElementById('userid'); var email = document.getElementById('emailid'); var select = document.getElementById('selection'); if(check_restrict(user,6,10)){ if(check_email(email,'Invalid Email address')){ if(check_select(select,'Please make a selection')){ return true; } } } return false; } function check_restrict(elem,min,max){ if(elem.value.length >= min && elem.value.length <= max){ return true; } else{ alert("Please enter " +min+ " to " +max+ "character") elem.focus(); return false; } } function check_email(elem,helperMsg){ var emailExp = /^[a-z0-9A-Z\.\-\_]+\@[a-zA-Z\-\.]+\.[a-zA-Z\.]{2,3}$/; if(elem.value.match(emailExp)){ return true; } else{ alert(helperMsg) elem.focus(); return false; } } function check_select(elem,helperMsg){ if(elem.value == "Please Choose"){ alert(helperMsg) elem.focus(); return false; } else{ return true; } } //--> </script> </head> <body> <form name="f1" onsubmit="return formValid()"> Username(6-10):<input type="text" id="userid" size=10 maxlength="15"><br/> Email Address:<input type="text" id="emailid" size=20 maxlength="20"><br/> <select id="selection"> <option>Please Choose</option> <option>Login</option> <option>Register</option> </select><br/> <input type="submit" value="Submit"> </form> </body> </html> Any help we be appreciated. Regards. hello i have a form which when the user hits "submit," the info in the textboxes is entered to a database. the only textbox which is not entered to the DB is an "age" textbox, which i need to verify to see if user is 18yrs or older. if user is not 18 years or older, they get an alert telling them they arent 18+. if they are, then the form submits this is my code so far, and i dont get any alerts when i enter an age younger than 18: Code: <head> <script language="text/javascript"> var age; document.getElementById("userage").value = age; if (age >=18) document.location="feedbacksaveanddisplay.php"; else { alert('Sorry, we can not let you in!') document.location="content.html"; } </script> </head> <form method = "post" action = "FeedbackSaveAndDisplay.php"> <input type = "hidden" name = "user" value = "test"/> <input type = "hidden" name = "pwd" value = "test"/> <p>Enter your name, feedback, score</p> <table> <tr> <td>Name</td> <td> <input type = "text" name = "name" style="width:150px; height:20px;" /> </td> </tr> <tr> <td>Feedback</td> <td> <input type = "text" name = "feedback" style="width:150px; height:20px;" /> </td> </tr> <tr> <td>Score</td> <td> <input type = "text" name = "score" style="width:150px; height:20px;" /> </td> </tr> <tr> <td>Product</td> <td> <input type = "text" name = "product" style="width:150px; height:20px;" /> </td> </tr> <tr> <td>Age</td> <td> <input type = "text" name = "age" style="width:150px; height:20px;" /> </td> </tr> <tr> <td colspan = "2"> <input type = "submit" value = "Submit" /> </td> </tr> </table> </form> any tips/advice on how to fix my code? the problem i think is in the javascript... will greatly appreciate any help thanks!! Hi all. I am using the Inline Form Validation Engine jQuery plugin found here, and though I have posted at their forum as well, am having a heck of a time (not being well versed in js OR Ajax, unfortunately) All I need to do is edit the code so that when the onSubmit function is processed, it returns only the first error it encounters, rather than keeping and display the array of every error. I have picked through the code several times, and can't seem to find where the array is stored. I thought perhaps I could find a for loop to limit, but am at a complete loss. Is there anyone out there who can help? I can post the code if needed; I didn't want to post the entire file (since I don't know which snippet is the one I need!) Thank you in advance! I'm trying to output something in a separate div if the information entered in the form is invalid. It is simply not working, no errors. Code: <script type="text/javascript" language="javascript"> function validateIGN(ign) { var validign = /^[a-zA-Z0-9]{1,30}$/; if (!validign.test(ign)) { document.getElementById.ignErrors.innerHTML = "<p>Your IGN is not formatted properly."; } else { } } </script> Heres the HTML where the onkeyup is.. Code: <form name= "newsletter" class="newsletter" action="doNewsletter.php" method="post"> <h2>Fill out this form if you want to be notified when the website is up!</h2><br/> <center><table class="twoslot"> <tr> <td>IGN(In Game Name):</td><td><input type="text" name="ign" onkeyup="return validateIGN(newsletter.ign.value);" /></td> </tr> <br/> <tr> <td>E-mail:</td><td><input type="text" name="email" /></td> </tr> <br/> <tr> <td> <center> <input type="submit" value="Submit" /> </center> </td> </tr> </table></center> <span style="font-size: .5em;">This is not working yet</span> </form> I'm having trouble figuring out this code. I have a isInitialsTextValid function that checks to see if the user enters their initials in the correct format. Then I have a function checkInitials. In the checkInitials function I am supposed (1)to declare a variable to be used for the boolean value returned by the isInitialsTextValid function.(2)call the isInitialsTextValid function.(3)If the value returned is false, place focus back on initials textbox.(4)If the value return is true call the submit function. I'm not sure what I am doing wrong, but I get a checkInitials is no defined error from firefox and it is pointing to my xhtml file. Here is the relevant code. XHTML FILE Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Form Example</title> <script type = "text/javascript" src= "Lab17.js"> </script> </head> <body onload="giveInitFocus();"> <form name = "form1" action = ""> <p> <input type = "button" value = "Total Cost" onClick = "checkInitials();" /> <input type = "reset" value = "Reset Order Form" name = "reset" /> </p> <hr /> <p> Please Enter the Cashier's Initials. </p> <p> <label> Cashier's Initials: <input type = "text" name = "initials" id = "initials" /></label> </p> <p> JAVASCRIPT FILE Code: function isInitialsTextValid() { var init = document.form1.initials; var position = init.value.search(/^[A-Z]{2,3}$/); if(position !=0) { alert("Initials must be 2 or 3 capital letters" + "\n Please re-enter"); return false; } else return true; } function checkInitials() { var returned; isInitialsTextValid(); if(returned == false) { document.form1.initials.focus(); } else if(returned == true) { handleSubmitClick(); } } Hi, I have placed a form validation script in my HTML and I think its all in the right place, however, when i load the page an error appears saying can not get object. Once I click past it, the form validation works as normal. Not sure how to get rid of this error. I have placed the link to the external validation script in the document head Any ideas? HTML Code: <div class="mb_content"> <h2>Work</h2> <div class="mb_content_inner"> <p>IMAGES COMING SOON.</p> </div> </div> <div class="mb_content"> <h2>Contact</h2> <p class="con_details_tel">tel: </p> <p class="con_details_email">email: </p> <div class="mb_content_inner"> <form id='contactus' name='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'> <fieldset > <input type='hidden' name='submitted' id='submitted' value='1'/> <input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>' value='<?php echo $formproc->GetFormIDInputValue(); ?>'/> <input type='text' class='spmhidip' name='<?php echo $formproc->GetSpamTrapInputName(); ?>' /> <div><span class='error'><?php echo $formproc->GetErrorMessage(); ?></span></div> <div class='container'> <label for='name' >Name: </label><br/> <input type='text' name='name' id='name' value='<?php echo $formproc->SafeDisplay('name') ?>' maxlength="50" /><br/> <span id='contactus_name_errorloc' class='error'></span> </div> <div class='container'> <label for='email' >Email:</label><br/> <input type='text' name='email' id='email' value='<?php echo $formproc->SafeDisplay('email') ?>' maxlength="50" /><br/> <span id='contactus_email_errorloc' class='error'></span> </div> <div class='container'> <label for='message' >Message:</label><br/> <span id='contactus_message_errorloc' class='error'></span> <textarea name='message' id='message'><?php echo $formproc->SafeDisplay('message') ?></textarea> </div> <div class='container'> <input type='submit' name='Submit' value='Submit' /> </div> </fieldset> </form> <script type='text/javascript'> var frmvalidator = new Validator('contactus'); frmvalidator.EnableOnPageErrorDisplay(); frmvalidator.EnableMsgsTogether(); frmvalidator.addValidation("name","req","Please provide your name"); frmvalidator.addValidation("email","req","Please provide your email address"); frmvalidator.addValidation("email","email","Please provide a valid email address"); frmvalidator.addValidation("message","maxlen=2048","The message is too long!(more than 2KB!)"); </script> </div> </div> </div> Here is the start of the javascript that is producing the error:- Code: function Validator(frmname) { this.validate_on_killfocus = false; this.formobj = document.forms[frmname]; if (!this.formobj) { alert("Error: couldnot get Form object " + frmname); return; } Can anyone help? Thanks nevblanc79 Hi all Sorry my first post is a question...but I hope you can help me out all the same. My name's Steve, and I have struggled (like all heck!) to figure this scenario out. I owe you a beer if you can help! OK, here's the scenario: I'm using a very basic redirect script, such as: Code: <html> <body> <script language="javascript" type="text/javascript"> function redirect(URL) { document.location=URL; return false; } </script> <a href="http://www.mywebsite.com" onclick="return redirect('http://www.mywebsite/contactme.html');">This Works</a> </body> </html> ...nothing you haven't seen a million times, right? BUT! I'd like the page I'm redirecting to (http://www.mywebsite/contactme.html) to open up an invisible iFrame, and then redirect the "parent" URL ("http://www.mywebsite.com") to an external site... So, 1) The visitor clicks on a link on my site (say, contactme.html) 2) The visitor is redirected to another page on my site (in an invisible iFrame)...e.g. mywebsite.com/processing.html 3) The iFrame loads in another invisible iFrame (for example, http://3rdpartysite.com/updatecontact.html) 4) The visitor on the contactme.html page is then redirected to a different domain (e.g. http://3rdpartysite.com/done.html) I've spent literally WEEKS trying to get this code going, and I'm now admitting defeat! I'm sure it's possible, but JS is not my specialist subject... ...at all I'd really appreciate ANY pointers, because I have a deadline to meet! Kind regards, Steve Ok so problem is that I'm using an XML generated intro for my website. My intro(index.html) is in the root directory with website home(index2.html). Issue is that I want the website to be loaded directly after intro in the same browser tab/window/page instead of a new one. Intro is using XML formatting and the Javascript being used is Asual SwfAddress 2.4 deeplinking for Flash and XML. Let me post some codes here from my website and intro; Intro.xml Code: <link url="index2.html" target="_self" /> Swfaddress.js 2.4 Where targets are set Code: {target=typeof target!=UNDEFINED?target:"_self";if(target=="_self"){self.location.href=url}else{if(target=="_top"){_l.href=url}else{if(target=="_blank"){window.open(url)}else{_t.frames[target].location.href=url}}}};this.popup=function(url,name,options,handler){try{var popup=window.open(url,name,eval(options));if(typeof handler!=UNDEFINED){eval(handler)}}catch(ex){}_popup=arguments} The intro is a template I'm using and I'm not familiar to its coding. I just want the intro to end and the website to load in the same browser window but its not happening. I've used other target options like 'parent' and 'top' but its not working. Also, on intro page there is a 'skip intro' button but when you click it intro keeps on playing and new window pop opens with the website. You can preview the website at; www.caterpowertrading.com and SWFaddress 2.4 at www.caterpowertrading.com/js/swfaddress.js No, its not using AS1-3. ~ Desperate Soul. PS: Sorry for multiple postings but its actually not! here is the link that i want to redirect http://www.xyz.com/tracks?hop=martit...e=1&varname2=2 when it will redirect the URL will be http://www.xyz.com/special?varname1=1&varname2=2 it's mean the hop and redirection variable will be remove from querystring, special is a page, it will take value from redirection variable, nothing will be hardcode. I'm a non-web programmer being forced to do some web programming. My immediate problem is that, on submission of a form, I need to be able to open a url (that I control) with the filled-in form values appended to the new url. In other words, I need to be able to do the equivalent of : Code: <form> <input name="key1" type="text"/> <input name="key2" type="text"/> <input type="button" value="Submit" onclick="window.open('http://new.domain.com/newpage.html?key1=val1&key2=val2')"/> </form> I would really like to do this without server-side code. Pointers? TIA Morning Guys, i have a little issue i need to tackle and i belive Javascript is the way forward on this, so looking for some pointers/help on the idea i have in mind. so basically i have a website and its going to be selling severall products. now i have a "Global" navigation which stays the same on every page throughout the website. now obviously if this is set into the master template all the links will be the same. 1 of my links will be a "buy now" button, i want this to never need changing but i want the link to direct to the correct purchasing page depending on which product is being described in the content area... so im guessing its going to need to fetch some sort of Value/Variable out the content and then use that to redirect to the correct page via that single "buy now" button.. any ideas or input cheers, ant. Hi, I am wanting to install an automatic re-direction script. I have seen some pretty complicated ones and then I came across this: Code: <script type="text/javascript"> <!-- if (screen.width <= 699) { document.location = "mobile.html"; } //--> </script> Is that going to work ? Thanks . hello, I am trying to figure out how to hide the direction page in this code: I want to hide: www.ipage.com/mail/index.bml <INPUT TYPE="submit" NAME="Log In" VALUE="Check Mail" onclick="javascript:login.action='http://www.ipage.com/mail/index.bml?s=1';javascript:login.destination.value = '/mailadmin/index.bml?check=1';" > </TD> <TD> <INPUT TYPE="submit" NAME="Log In" VALUE="Manage Mail" onclick="javascript:login.action='https://secure.ipage.com/mailLogin';javascript:login.destination.value = '/mailadmin/index.bml?manage=1';"> any help is appreciated.... Hi, I want to write a javascript program which will redirect the user from a welcome page to an an intro page when a cookie is found. If there are not cookies found, the welcome page is loaded but a cookie is written so that next time the user visits the page, he will be redirected to the intro page automatically. This program would allow only new visitor to view the welcome page and other visitors to skip the welcome page to be brought to the intro page right away. I am a newbie and here is the code which I have though of so far. Can someone expand on it? Thanks The Apprentice Code: window.onload = pageInit; function pageInit(){ var visited = ""; if (document.cookie !=""){ window.location = "introPage.htm"; } else{ setCookie(); } function setCookie(){ document.getElementById("click").onclick = cookie; var expireDate = new Date(); expireDate.setMonth(expireDate.getMonth() + 6); Hey guys, So I'm currently trying to make a page redirect using the following code: Code: <img src=foo.png onerror=location.replace('%68%74%74%70%3A%2F%2F%67%6F%6F%67%6C%65%2E%63%6F%6D');> The encoded html part is simply a link http://google.com The code works fine so far on all browsers. But the problem is that it redirects wrongly. It should be redirecting to http://google.com Instead, it takes me to http://mysite.com/http://google.com How do I fix this? Thanks a lot P.S: I cannot use any code for redirection that has an (=) equals sign Which means I can't use location.href='http://google.com' |