JavaScript - Alert Message Before Enter Page
Hell All
Can some1 give me a function for Alert Visitor before the page Load if he /she Sure wants to See the Page . I have function Onclick alert message but i want the function is when click and go to the page and before the page load to ask 'if want realy to see the page' if yes return true if cancel or no to go back to where he come from. Thank you and hope such function exist. Similar Tutorialshow i can refresh my main history page without page refresh alert message? i am using the following code on the submitpage.asp <%response.write ("<script>window.location.reload(history.go(-2));</script>")%> i got the attached message when it refreshes the main page. is there is a way to refresh directly without this message? Hi there, I am trying to add something from a textbox within a prompt message into a listbox. When I press the "Add" button, a prompt message will pop up. I will check if the textbox is empty. If it is empty and I press okay, it will show an alert message stating "Empty insert. Please enter something into the textbox." And if I press cancel, it will show alert message "You have pressed cancel." If it is not empty, and I press okay, it will insert the data into the listbox successfully. If I press cancel, it will show alert message "You have pressed cancel." Below are my codes. Javascript Code: function addOption() { var newItem = prompt("Enter New Item"); if (!newItem == "") { var answer = confirm ("Are you sure you want to add? ") if (answer)//if answer is true { var lstBx = document.getElementById("lstBxEmail"); // Now we need to create a new 'option' tag to add to MyListbox var newOption = document.createElement("option"); newOption.value = newItem; // The value that this option will have newOption.innerHTML = newItem; // The displayed text inside of the <option> tags // Finally, add the new option to the listbox lstBx.appendChild(newOption); //sort items in listbox in alpha order arrTexts = new Array(); for(i=0; i<lstBx.length; i++) { arrTexts[i] = lstBx.options[i].text; } arrTexts.sort(); for(i=0; i<lstBx.length; i++) { lstBx.options[i].text = arrTexts[i]; lstBx.options[i].value = arrTexts[i]; } } else { if(newItem) { alert("Key something to textbox please."); } else alert("Cancel choice."); } } } HTML Code: <center><input id="Submit18" type="submit" value="Add Address" onclick="addOption()"/> <div>Address:</div> <center> <select id="lstBxEmail" name="listBoxEmail" multiple="multiple" style="width: 580px;"> <option>Java</option> <option>PHP</option> <option>Perl</option> <option>Javascript</option> <option>C#</option> <option>Powershell</option> </select> </center> okay. I am in the process of learning javascript and I've been looking at this code for the longest time ever. So far I got most of it done. but the problem is for example I leave all the required fields empty, it gives me the alert message of the first field and not the alert messages of all the others. What I want to know is how can you go through and check the whole form first before submitting and then when there is any error on any field, shows just one alert message containing all the error messages. code for the form Code: <form action="mailto:hummdedum@felloff.com" method="post" name="form" onSubmit="return isFormValid();"> * First Name: <input type="text" name="FName" id="FName" onblur="checkFName();"/><label id="labelFName"></label><br /> * Last Name: <input type="text" name="LName" id="LName"onblur="checkLName();"/><label id="labelLName"></label><br /> * Password: <input type="password" id="pw" name="Password" onblur="checkpw();" id="pw"/><label id="labelpw"></label><br /> *Re-type Password: <input type="password" name="2Password" id="pw2" onblur="checkpw2();" /><label id="labelpw2"></label><br /> I am a: <br /> <input type="radio" name="status" value="fresh" /> Freshman<br /> <input type="radio" name="status" value="soph" /> Sophomore<br /> <input type="radio" name="status" value="jr" /> Junior<br /> <input type="radio" name="status" value="sr" /> Senior<br /> I am taking classes in the: <br /> <input type="checkbox" name="semester" value="fall" /> fall time<br /> <input type="checkbox" name="semester" value="spring" /> Spring time <br /> My favorite element is: <select name="element" id="element"> <option value="">select one</option> <option value="fire">Fire</option> <option value="earth">Earth</option> <option value="water">Water</option> <option value="air">Air</option> </select><br /> *Birthday: <input type="text" id="BDay" name="Birthday" onblur="checkBDay();"/><label id="labelBDay"></label><br /> *E-Mail: <input type="text" id="email" name="Email" onblur="checkEmail();"/><label id="labelEmail"></label><br /> <input type="submit" value="Submit" /> <input type="reset" value="Clear" /> </form> code for the javascript Code: function isFormValid() {var userF = document.getElementById('FName').value; var userL = document.getElementById('LName').value; var userPW = document.getElementById('pw').value; var userPW2 = document.getElementById('pw2').value; var userBDay = document.getElementById('BDay').value; var userEmail = document.getElementById('email').value; var NameFormat = /^[A-Za-z]{2,12}$/; var PWFormat = /^[A-Za-z0-9{6,12}$]/; if (!NameFormat.test(userF)) { alert("First Name is required and should only have letters. 2-12 letters max"); return false; } if (!NameFormat.test(userL)) { alert("Last Name is required and should only have letters. 2-12 letters max"); return false; } if (!PWFormat.test(userPW)) { alert("Password is required and should only have letters and numbers. 6-12 letters max"); return false; } if (userPW != userPW2) { alert("Passwords do not match."); return false; } } function checkFName() { var userF = document.getElementById('FName').value; var elementF = document.getElementById('labelFName'); var NameFormat = /^[A-Za-z]{2,12}$/; if (!NameFormat.test(userF)) { elementF.innerHTML = "First Name is required and should only have letters. 2-12 letters max"; elementF.style.color = "red"; } else { elementF.innerHTML = ""; elementF.style.color = "green"; } } function checkLName() { var userL = document.getElementById('LName').value; var elementL = document.getElementById('labelLName'); var NameFormat = /^[A-Za-z]{2,12}$/; if (!NameFormat.test(userL)) { elementL.innerHTML = "Last Name is required and should only have letters. 2-12 letters max"; elementL.style.color = "red"; } else { elementL.innerHTML = ""; elementL.style.color = "green"; } } function checkpw() { var userPW = document.getElementById('pw').value; var elementPW = document.getElementById('labelpw'); var PWFormat = /^[A-z0-9]{6,12}$/; if (!PWFormat.test(userPW)) { elementPW.innerHTML = "Password is required and should only have letters and numbers. 6-12 letters max"; elementPW.style.color = "red"; } else { elementPW.innerHTML = "Valid Password"; elementPW.style.color = "green"; } } function checkpw2() { var userPW2 = document.getElementById('pw2').value; var userPW = document.getElementById('pw').value; var elementPW2 = document.getElementById('labelpw2'); if (userPW != userPW2) { elementPW2.innerHTML = "Passwords do not match."; elementPW2.style.color = "red"; } else { elementPW2.innerHTML = "Passwords Match"; elementPW2.style.color = "green"; } } I want to also validate birthday.. and I tried using regular expression with leap years but the expression is too hard for me to think of. so I am gonna try using split() but I dont noe... and for the clear button. since I blur functions, how would I just clear all the blur statements = like a restart of the form and then when the user enters the field the blur function still works? thanks -pumpkin Firebug is giving me no error messages, but alert() message is never triggered. I want the alert() message defined below to alert what the value of the variable result is (e.g. {filter: Germany}). And it doesn't. I think the javascript breaks down right when a new Form instance is instantiated because I tried putting an alert in the Form variable and it was never triggered. Note that everything that pertains to this issue occurs when form.calculation() is called: markup: Code: <fieldset> <select name="filter" alter-data="dropFilter"> <option>Germany</option> <option>Ukraine</option> <option>Estonia</option> </select> <input type="text" alter-data="searchFilter" /> </fieldset> javascript (below the body tag) Code: <script> (function($){ var listview = $('#listview'); var lists = (function(){ var criteria = { dropFilter: { insert: function(value){ if(value) return handleFilter("filter", value); }, msg: "Filtering..." }, searchFilter: { insert: function(value){ if(value) return handleFilter("search", value); }, msg: "Searching..." } } var handleFilter = function(key,value){ return {key: value}; } return { create: function(component){ var component = component.href.substring(component.href.lastIndexOf('#') + 1); return component; }, setDefaults: function(component){ var parameter = {}; switch(component){ case "sites": parameter = { 'order': 'site_num', 'per_page': '20', 'url': 'sites' } } return parameter; }, getCriteria: function(criterion){ return criteria[criterion]; }, addCriteria: function(criterion, method){ criteria[criterion] = method; } } })(); var Form = function(form){ var fields = []; $(form[0].elements).each(function(){ var field = $(this); if(typeof field.attr('alter-data') !== 'undefined') fields.push(new Field(field)); }) } Form.prototype = { initiate: function(){ for(field in this.fields){ this.fields[field].calculate(); } }, isCalculable: function(){ for(field in this.fields){ if(!this.fields[field].alterData){ return false; } } return true; } } var Field = function(field){ this.field = field; this.alterData = false; this.attach("change"); this.attach("keyup"); } Field.prototype = { attach: function(event){ var obj = this; if(event == "change"){ obj.field.bind("change", function(){ return obj.calculate(); }) } if(event == "keyup"){ obj.field.bind("keyup", function(e){ return obj.calculate(); }) } }, calculate: function(){ var obj = this, field = obj.field, msgClass = "msgClass", msgList = $(document.createElement("ul")).addClass("msgClass"), types = field.attr("alter-data").split(" "), container = field.parent(), messages = []; field.next(".msgClass").remove(); for(var type in types){ var criterion = lists.getCriteria(types[type]); if(field.val()){ var result = criterion.insert(field.val()); container.addClass("waitingMsg"); messages.push(criterion.msg); obj.alterData = true; alert(result); initializeTable(result); } else { return false; obj.alterData = false; } } if(messages.length){ for(msg in messages){ msgList.append("<li>" + messages[msg] + "</li"); } } else{ msgList.remove(); } } } $('#dashboard a').click(function(){ var currentComponent = lists.create(this); var custom = lists.setDefaults(currentComponent); initializeTable(custom); }); var initializeTable = function(custom){ var defaults = {}; var custom = custom || {}; var query_string = $.extend(defaults, custom); var params = []; $.each(query_string, function(key,value){ params += key + ': ' + value; }) var url = custom['url']; $.ajax({ type: 'GET', url: '/' + url, data: params, dataType: 'html', error: function(){}, beforeSend: function(){}, complete: function() {}, success: function(response) { listview.html(response); } }) } $.extend($.fn, { calculation: function(){ var formReady = new Form($(this)); if(formReady.isCalculable) { formReady.initiate(); } } }) var form = $('fieldset'); form.calculation(); })(jQuery) Thanks for response. hey i have combo box it has names name -1 name-2 name-3 name-4 when select a name-1 just display a alert message of age plz help me to do this plz any sample coding for this I have an user table like this:- guid | username | password | firstname | lastname | location | emailad dress | userrole -----------------------------------+----------+----------------------------------+-----------+-----------+----------+-------- ------+--------------- 8024259764dc3e8ee0fb6f5.84107784 | james | 827ccb0eea8a706c4c34a16891f84e7b | james | bond | NY | ny@live .com | administrator 18689183644dc3e91571a364.71859328 | saty | 250cf8b51c773f3f8dc8b4be867a9a02 | saty | john | NY | hk@fd.c om | administrator 2644885344cecd6f2973b35.63257615 | admin | 21232f297a57a5a743894a0e4a801fc3 | System | Generated | | | administrator (3 rows) now my postgre query for delete the row .... $query = "delete from users where username!= 'admin' and guid='".$guid."'"; $result = pg_query($conn, $query); ?> <script type="text/javascript"> alert("Cannot delete this .\n It is system generated(s)."); </script> <?php (1)when I delete the user name one by one then delete occurs in my page userlist.php, I donot want to delete admin so i use username!= 'admin' in where condition as shown above. (2)now when I del any username(3 rows) from user table then alert occurs & it delete from userlist.php after that my page userlist.php is blank. Finaly when i refresh the page then my admin username seen.. when i use return true; function then only alert generate .. delete doesnot occurs ... Actauly i want:- (1)if user is not admin then it delete from userlist.php ... nd also i m continue on this page ... like when james and saty want to delte their acount ..as given in table. (2)if user is admin then alert generate nd i m continue on this page. i m tired now plz help me .... so can anyone put the best condition in my coding. Hi all, new here. Hope this makes sense. In Salesforce, I am adding what they call an "S-Control" via HTML/JavaScript that will display an alert if certain field criteria are met. The alert would be a reminder to hit the "Submit for Approval" button if the Quote Estimate is equal to or greater than $50,000. For testing purposes I added another criteria, that the Opportunity name must = Test and Stage must = Proposal/Price Quote. Here's what I've come up with so far, taking from other examples, but I receive no alert, so I'm wondering where it went wrong. Code: <html> <head> <script type="text/javascript" language="javascript" src="/js/functions.js"></script> <script type="text/javascript" src="/soap/ajax/10.0/connection.js"></script> <script type="text/javascript"> function throwalert() { // Begin by creating 3 variables for the criteria to be met. var oppname = "{!Opportunity.Name}"; var isstatus = "{!Opportunity.StageName}"; var quoteest = "{!Opportunity.Quote_Estimate__c}" // Now create a function which will decide if the criteria is met or not and throw alert message. //var oppname= "Test" //var quoteest >= "50000" //var isstatus = "Proposal/Price Quote" var msgg = "The quote estimate for this opportunity is equal to or greater than $50,000. Remember to submit this opportunity for approval. " if ((oppname == "Test") && (quoteest >= 50000) && (isstatus == "Proposal/Price Quote")) { alert(msgg); } else { window.parent.location.replace = "{URLFOR($Action.Opportunity.View, Opportunity.Id,null,true)};" } } </script> </head> <body onload="throwalert()";> </body> </html> I've got this form on my page that contains a search box and a select box full of employee names. When you type a few letters in the search box it scrolls through the listbox to the first match and then if you click on that name it executes a function. Today though one of my coworkers pointed out that some people would just hit enter inside the search box and he's right about that. So I looked around and found the solution for it, it's the onkeydown event I added to the search box. Weird thing is though when you type a name in the box and hit enter it executes properly and then the page immediately reloads Without the onkeybown event, hitting Enter still makes the page reload so it's gotta be something about the form. Can anyone pick out the bug? Thanks. <form name="people_form" style="margin: 0px"> <input type="text" id="peoplesearch" name="peoplesearch" onkeydown="if (event.keyCode == 13) search_onblur()" onblur="search_onblur()" onkeyup="suggestName();" onfocus="this.value=''" style="margin: 0px 0px 5px 0px; padding: 0px; width: 215px"></input> <select onchange="display.apply(this, this.value.split(','))" size="15" id="People" name="People" style="border-style: none; height:244px; width:220px; margin-bottom: 15px;"> <option>Loading</option> </select> </form> My problem is the following. I have an editable <div>: <div class='edit' id='divContent' name='divContent' ContentEditable>some text</div> If I press 'enter' two lines are skipped. I know that if I press 'shift+enter' only one line will be skipped. If I check the unformatted code of the contenteditable div, 'enter' gives me <p> and 'shift+enter' gives me <br>, which makes sense because <p> is formatted differently than <br>. So I want to change 'enter' into 'shift+enter' I have already found something to capture and kill 'return' function killReturn() { key = event.keyCode; if (key == 13) return false; } But now for some means to replace the killed 'enter' with 'shift+enter'? Thanks a lot in advance for any advise! Hi Guys, seen some pages who give alerts or Warnings mentioning that i'm moving away from my webpage. Best example is hotmail when you are on the compose mail screen and when click another link it is asking for confirmation. Can you one please shed some light on how to do this. Your help is greatly appreciated. Cheers Dileep Bear with me, as I do not know where the problem lies. I know this is a lot of code. I have acquired this code and am not sure what to change to make it work how I want it to. Basically it prompts, with a Javascript alert, for the visitor to take a survey. If they hit OK it redirects them to a landing page, if they hit CANCEL it lets them go on their way. FIRST OFF THANK YOU SOOOO MUCH FOR ANY HELP YOU CAN PROVIDE ME!!! I would like for the script to execute even when the visitor types a URL in the address bar and exits that way versus just alerting the visitor when they click an external link. That is the main goal that I need help with. I would also like the script to use cookies so that it doesn't pop up for a visitor more than once in either 7 or 14 days. This isn't as big of a deal as the problem listed above but is more of a bonus if I can get it. I have listed all pages with code that pertain to this code because, as listed above, I do not know where the problem lies. If it helps, this code is also based off of the jQuery code. Below is the page where the code executes: Code: <html> <head> <script src="SurveyRelocationManager.js"> <!-- --> </script> <script type="text/javascript" src="jquery.js"></script> <script> <!-- var srm; function init(){ srm = new SurveyRelocationManager(); srm.setSurveyURL("http://www.poddcorp.com"); //change to the correct survey URL //add the internal URLs, if internal popup does not deploy srm.addInternalURL("https://secure3.convio.net/ucs/site/Advocacy/"); srm.addInternalURL("http://ucs.convio.net/site/Ecard/"); srm.addInternalURL("https://secure3.convio.net/ucs/site/Donation/"); srm.addInternalURL("http://ucs.convio.net/site/UserLogin/"); srm.addInternalURL("http://ucs.convio.net/site/PageServer?pagename=sign_up/"); srm.addInternalURL("http://www.ucsusa.org/"); $("a").click(function () { return srm.onBeforeClick(this); }); } window.onload = init; --> </script> </head> <body> <a href="http://www.ucsusa.org/internal.html">internal</a><br /> <a href="http://www.themmrf.org/donate-now-take-action/join-an-event/powerful-athletes/mmrf-triathlon-and-cycling.html">external link</a><br /> <a href="internal.html">internal</a><br /> <a href="http://www.yahoo.com">external link</a><br /> <a href="http://www.ucsusa.org/global_warming/">another internal</a> </body> </html> Below is other code (SurveyRelocationManager.js) that helps execute the script: Code: function SurveyRelocationManager(){ //Constr. this.aInternalURLs = new Array(); } SurveyRelocationManager.prototype.init = function(){ this.setInternalURLs(); } SurveyRelocationManager.prototype.setSurveyURL = function(s){ this.sSurv = s; } SurveyRelocationManager.prototype.getSurveyURL = function(){ return this.sSurv.valueOf(); } SurveyRelocationManager.prototype.addInternalURL = function(s){ this.aInternalURLs.push(s); } SurveyRelocationManager.prototype.removeInternalURL = function(s){ for(var a = 0; a<this.aInternalURLs.length; a++){ if(this.aInternalURLs[a] == s){ this.aInternalURLs.splice(a, 1); } } } SurveyRelocationManager.prototype.getInternalURLs = function(){ return this.aInternalURLs.slice(0); } SurveyRelocationManager.prototype.getURLIsInternal = function(s){ var t; /* KLUDGE: t.indexOf returns -1 if aInternalURLs has no slash at the end. Somehow forward slashes cancels the eval. TODO: Refactor t.indexOf. */ for(var a = 0; a<this.aInternalURLs.length; a++){ t = this.aInternalURLs[a]; // if(s.indexOf(t) != -1){ return true; }else if(s.indexOf('http://') == -1) return true; } return false; } SurveyRelocationManager.prototype.onClick = function(o){ var b = this.getURLIsInternal(o.toString()); if(!b){ var c = confirm("Do you want to take the survey?"); if(c){ //TODO: Relocate here. document.location = this.getSurveyURL(); } else { return true; } } else { return true; } return false; } Note: The only other page that isn't located on this post is the jQuery code. Because of it's length it wouldn't allow me to include the code. You can visit jquery.com to view the code. Or message me and I can send it. THANKS A MILLION! Hi, Can anyone please tell me that " how to write a JavaScript function to pop up an alert() if a user scrolls down the webpage faster than a certain speed" Looking forward for a urgent reply Thanks currently working on a project and I cant figure the right coding to get my results to pop up in a new page, same window AND an alert box. I got the alert box part down perfectly but cannot figure out how to get my results. Even if i can figure out how to get them on the same page in their designated field, I can probably figure the rest out, the coding i have so far looks like this: ( i cant figure out how to make it look cool in a diff. window... sorry) <HTML> <HEAD> <b> Here is a pay slip generator that will determine your net annual salary. <br> Simply type in your first and last name along with gross salary and hit calculate. <br> Doing this will let you know how much you will end up paying in both Federal and State taxes. </b> <form action="" method="post"> <p> Enter your First Name: <input name="num1" type="text" id="num1" size="10" maxlength="10"> </p> <p> Enter your Last Name: <input name="num2" type="text" id="num2" size="10" maxlength="10"> </p> <p> Enter your gross salary: <input name="num3" type="#" id="num3" size="10" maxlength="10"> </p> Click this button to calulate your annual net pay! <script type="text/javascript"> function calculate() { var fName = document.getElementById('num1').value; var lname = document.getElementById('num2').value; var sal = Number(document.getElementById('num3').value); alert('Hello '+ fName + ' '+ lname + ', you would pay $'+ sal * .2 + ' in Federal taxes and $'+ sal * .1 + ' in State taxes, leaving you $'+ sal * .7 + ' to take home annually!'); //for testing } </script> <input type="button" onclick="calculate()" value="Generate Pay Slip" /> <input type="button" value="Reset Form" onClick="this.form.reset()" /> <p>Total federal taxes: <input name="num4" type="#" id="num4" size="10" maxlength="10" value= N/A> </p> <p>Total State taxes: <input name="num5" type="#" id="num5" size="10" maxlength="10" value= N/A> </p> <p>Net annual salary: <input name="num6" type="#" id="num6" size="10" maxlength="10" value= N/A> <script type="text/javascript"> function show_results { var ftax = document.getElementbyId('num4').value; var stax = document.getElementbyId('num5').value; var npay = document.getElementbyId('num6').value; } </TEXTAREA> </FORM> </body> </html> </script> Any clues would be very helpful I'm writing a calculator script that will need user input (how much they pay on internet, phone or cable bill) and then multiply those numbers by a known rate and then show the customer the new number. I have the math setup (working right now), and the script works to spit out the answers in an alert. Instead of the alert (which is the only thing I can do correctly at this point), I need the script to give the answers for each bill and then a total answer at the bottom. The script is here, it's all in the index file. http://gotsmith.com/calculator/ Thanks. Hi there guys! My group is working on a basic document management system that includes four users. staff member, department director, division chief and clerk. The programming language that we used is PHP. when staff member logs-in on his homepage and uploads a file he must choose reviewer from a dropdown menu that consists of dep. director and div. chief. When he clicks the upload button the homepage of who he chose as reviewer should receive a prompt/alert box upon log-in saying "you have a document to review". For example: if he chose division chief as the reviewer when the person logs-in on his homepage a prompt/alert should display that he has something to review. The code for uploading file is already up and working. We are looking for advice on how to integrate javascript in this system. Especially in the prompt part. thanks for your ideas. javascript2.js Code: function displayMessage(msg) { // Open a new window var msgWindow = window.open('', 'Message'); // Write message in the new Window msgWindow.document.write(msg); // Raise this window, in case it's not visible msgWindow.focus(); } //Enter total number of questions: var totalquestions=13 var correctchoices=new Array("a","a","b","c","b","c","a","a","b","c","a","b","b"); var correctanswers=new Array("memory locations","_ underscore","x=5+5;","20","Else","lose win","ticker = ticker + 1;","Ticker = ticker + 1;","300.000","Jonathon \b","var","var counter;","var mark = 50, 70"); function gradeit(){ var actualchoices=new Array() var msg1=new Array() var correctanswersno=0 var t=0 var displaycorrectanswers="" for (q=1;q<=totalquestions;q++){ var thequestion=eval("document.Questionform.q"+q) for (c=0;c<thequestion.length;c++){ if (thequestion[c].checked==true) actualchoices[q]=thequestion[c].value } if (actualchoices[q]==correctchoices[q]){ msg1[t]=q+")"+" Correct"; correctanswersno = correctanswersno + 1; t = t + 1; } else { msg1[t]=q+")"+" Incorrect: <br>Correct Answer: "+correctchoices[q]+") "+correctanswers[q]; t = t + 1; } } for (p=0;p<=12;p++){ displaycorrectanswers+="<br>"+msg1[p]; } var msg="Sco "+correctanswersno+"/"+totalquestions+" <br><br>Marks: "+displaycorrectanswers; displayMessage(msg); } Basically on my index page it has a button which when clicked makes use of gradeit(). Currently this then used displayMessage(msg) which opens a new window and displays the message. However, what I want it to do is to open another created html page e.g. answer.html and then for this page to display the message. How do i do this? Hi I have a problem with a form in my site he http://www.21centuryanswers.com/submit.php if no field is filled and you click submit, an alert will be shown, yet the next page will still load! How do I fix it? the code for the form is: <form action="privacy.php" method="post" onsubmit="return checkform(this);"> <fieldset> <center> E-mail: <input type="textfield" name="email" size="60" value="" /><br/></br> Question: <input type="textfield" name="question" size="70" value="" /><br/><br/> <input type="submit" value = "Submit"/> </center> </fieldset> </form> and here is the validation script: <script language="JavaScript" type="text/javascript"> <!-- function checkform ( form ) { // ** START ** if (form.email.value == "") { alert( "Please enter your email." ); form.author.focus(); return false ; } if (form.question.value == "") { alert( "Please enter the question." ); form.title.focus(); return false ; } // ** END ** return true ; } //--> </script> Please help! <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="Content-Style-Type" content="text/css"><meta http-equiv="Content-Script-Type" content="text/javascript"><script type="text/javascript">function sendV(f){location.href='https://sandbox.google.com/checkout/api/checkout/v2/checkoutForm/Merchant/' +f['id'].value +'?' +f['item_name_1'].name+'='+f['item_name_1'].value + '&' +f['item_description_1'].name+'='+f['item_description_1'].value + '&'+f['item_quantity_1'].name+'='+f['item_quantity_1'].value + '&' +f['item_price_1'].name+'='+f['item_price_1'].value;;}</script></head><body><form action="POST"> <input type="text" name="id"><input type="hidden" name="item_name_1" value="Peanut Butter"/><br/> <!-- Product Description --><i>Chunky peanut butter</i><input type="hidden" name="item_description_1" value="Chunky peanut butter."/><br/> <!-- Quantity --><input type="hidden" name="item_quantity_1" value="1"/> <!-- Unit Price -->Price: $<input type="text" name="item_price_1"/><br/> <!-- charset=UTF-8; Do not remove this line --><input type="hidden" name="_charset_"/> <input name="sub" value="Send value" type="button" onclick="sendV(this.form)"></form></body></html>---End Quote---
How Do I Put An Error Message In This Age vervication htm page Below? ---------------------------------------------------------------------- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="shortcut icon" href="http://cdn.battlefieldbadcompany2.com//misc/favicon.ico" type="image/x-icon"> <link type="text/css" rel="stylesheet" media="all" href="./agegate_files/css_2b22bb76f86419edef5093a148bae2d9.css"> <link type="text/css" rel="stylesheet" media="print" href="./agegate_files/css_d34ed7daed866afd03ff14a52c469b82.css"> <!--[if IE]> <link type="text/css" rel="stylesheet" media="all" href="http://battlefieldbadcompany2.com/sites/all/themes/zen_ninesixty/css/ie.css?D" /> <![endif]--> <script type="text/javascript" src="./agegate_files/js_07d74692b8bac063e891abbaba65653e.js"></script> <script type="text/javascript"> <!--//--><![CDATA[//><!-- jQuery.extend(Drupal.settings, { "basePath": "/", "thickbox": { "close": "Close", "next": "Next \x3e", "prev": "\x3c Prev", "esc_key": "", "next_close": "Next / Close on last", "image_count": "Image !current of !total" } }); //--><!]]> </script> </head> <body class=" agegate"> <div id="wrapper"> <div id="page" class="container-12"> <div id="site-header"> <div id="header-inner" class="grid-12"> </div> </div> <!-- End 'site-header' --> <div class="agegate-block"> <div class="agegate-header"> <h2>Enter your age</h2> </div> <div class="content"> <img src='enterage.gif' /> <form action="./agegate_files/agegate.htm" accept-charset="UTF-8" method="post" id="agegate-form" class="agegate-form"> <div><div class="languages"><h3>Country ( US ONLY )</h3><div class="flag-wrapper"><div><ul> <li class="en"> <a class="active" href="agegate.htm"> <img height="20" width="36" title="English" alt="English" class="language-icon" src="./agegate_files/en.gif"> </a> </li> </ul></div></div></div><div class="form-item" id="edit-age-wrapper"> <input type="text" maxlength="2" name="age" id="edit-age" size="2" value="" class="form-text agegate-age-input"> </div> <div class="form-item"><a href='index.htm'><input type="submit" name="op" id="edit-submit" value="Continue" class="form-submit agegate-submit-btn"></a> </div><input type="hidden" name="form_build_id" id="form-6167175a48bd92c722f6decc9d1c5ac7" value="form-6167175a48bd92c722f6decc9d1c5ac7"> <input type="hidden" name="form_id" id="edit-agegate-form" value="agegate_form"> </div></form> </div> </div> </div> <!-- End 'page' --> </div> <!-- End 'wrapper' --> <div id="omnitureWrapper" style="display: none;"><script language="javascript" src="./agegate_files/utils.js"></script> <script language="JavaScript"><!-- var language = "en"; omniture="home"; var country = ""; var category = ""; var host = ""; switch(language) { case "en": country = "us"; category = "NA"; language = "en-US"; host = "eaeacom,eaeacomna,eaeabrandna,eagamebfbc2na,eagamebfbc2global"; break; case "en-gb": country = "uk"; category = "EMEA"; language = "en-GB"; host = "eaeacom,eaeacomeu,eagamesuk,eagamebfbc2uk,eagamebfbc2global"; break; default: country = "us"; category = "NA"; language = "en-US"; host = "eaeacom,eaeacomna,eaeabrandna,eagamebfbc2na,eagamebfbc2global"; break; } var s_account=omniCheckHost(host) var s_imageDisableFlag = 0; //--></script> <script type="text/javascript" language="JavaScript" src="./agegate_files/s_code_remote_v02.js"></script> <script language="JavaScript"><!-- s_ea.server="" s_ea.channel="" s_ea.prop1=s_ea.setUserState('No ID') s_ea.prop2="BFBC2" s_ea.prop3="GAMES" s_ea.prop4="BATTLEFIELD" s_ea.prop5= "BFBC2"; s_ea.prop7= "DICE"; s_ea.prop9= "MKT"; s_ea.prop10= "Agegate"; s_ea.prop11= category; s_ea.prop12= language; s_ea.prop15= "General Info"; s_ea.prop17= country.toUpperCase(); s_ea.prop18= country.toUpperCase()+":BFBC2"; s_ea.pageName=category+":"+country.toUpperCase()+":"+s_ea.prop3+":"+s_ea.prop7+":"+s_ea.prop9+":"+s_ ea.prop4+":"+s_ea.prop2+":"+s_ea.prop5+":"+s_ea.prop10.toUpperCase(); /* E-commerce Variables */ s_ea.eVar1="No ID"; s_ea.eVar3="BFBC2"; s_ea.eVar17=country.toUpperCase(); s_ea.eVar18=category ; s_ea.eVar29=s_ea.setInitValOnce(country.toUpperCase()+":"+s_ea.prop2+":"+s_ea.prop5); s_ea.eVar30=country.toUpperCase()+":"+s_ea.prop2+":"+s_ea.prop5; s_ea.eVar34="GAMES";/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/ if((s_imageDisableFlag == null) || (typeof (s_imageDisableFlag) == "undefined") || (!s_imageDisableFlag)){var s_code=s_ea.t();if(s_code)document.write(s_code);}//--></script><!-- End SiteCatalyst code version: H.0. --><script language="javascript" type="text/javascript" src="./agegate_files/omniture_wrapper.js"></script></div> </body></html> Hi, I have dozens of pages on my website which have just started showing an 'Error on page' message at the bottom left of Internet Explorer 8.0. These messages do not appear when using Mozilla Firefox. My website is www.lakesandcumbria.com and an example of a page showing the error message is http://www.lakesandcumbria.com/view/walks/ambleside.htm which contains a javascript drop down list. All other pages using this type of drop down list are showing the same error message (dozens of them). I have ensured that 'Script debugging' is disabled in Internet Explorer but this hasn't helped! Help - How can I stop this happening in Internet Explorer 8.0 please? |