JavaScript - Javascript Seating Plan
Hey guys,
I'm working on a javascript seating plan at university (i understand the rules but im not asking for you to do it for me, mearly to help me)... What i've got is a seating plan for a cinema auditorium where there are two types of seats; premium teared seating and regular seating. The premium seats are 10pounds and the regular seats are 5 pounds. I've written the javascript to my ability so far... What i've got just now is the ability to roll over the "available" seats which then does a JS Roll-Over that makes them "mine" seats, and then if you click "Confirm Choices" Button it displays the "mine" seats selected as "taken" seats. It also adds up the seats (10 pounds each). However I've only done the premium seats at the moment and i am unsure of how to do the 5 pound "regular" seats. Here's my javascript code... Code: onload=function(){ myAnchors=document.getElementsByTagName("a"); myImages=document.getElementById("tableA").getElementsByTagName("img"); for (var i=0;i<myAnchors.length;i++){ myAnchors[i].setAttribute('onmouseover','getMine('+i+')'); myAnchors[i].setAttribute('onmouseout','getAvailable('+i+')'); myAnchors[i].setAttribute('onclick','freezeMe('+i+')'); myAnchors[i].setAttribute('id','A'+i); myImages[i].setAttribute('id',i); totalprice =0; } } function getMine(id){ myImages[id].setAttribute('src','images/mine.gif'); } function getAvailable(id){ myImages[id].setAttribute('src','images/available.gif'); } function freezeMe(id){ if(myAnchors[id].getAttribute('onmouseover')==''){ myAnchors[id].setAttribute('onmouseover','getMine('+id+')'); myAnchors[id].setAttribute('onmouseout','getAvailable('+id+')'); } else { myAnchors[id].setAttribute('onmouseover',''); myAnchors[id].setAttribute('onmouseout',''); myImages[id].setAttribute('src','images/mine.gif'); totalprice += 10; } document.getElementById("totalprice").innerHTML = totalprice; } function confirmChoices(){ for (var i=0;i<myAnchors.length;i++){ if(myImages[i].getAttribute('src')=='images/mine.gif'){ myImages[i].setAttribute('src','images/taken.gif'); myAnchors[i].setAttribute('onclick',''); document.getElementById("checkout") } } } function resetAll(){ window.location="home.html"; } and here's my HTML code (there is some styling you can ignore ) Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title> Welcome to Hub Tickets Online </title> <script type="text/javascript" src="scripts/cw1.js"></script> <script type="text/javascript" src="scripts/cw1_2.js"></script> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div id="header"></div> <div id="wrapper"> <div id="navigation"> <img src="images/logo.png"> </div> <div id="myTickets"> <h1>My Tickets</h1> <div id="myTicket"> <h3>Your Seat Selection:</h3> </div> <div id="myPrice"> <table> <tr> <td>Total Price: £</td> <td><div id="totalprice"></div></td> </tr></table> </div> <div id="key"><p><input type="button" id="checkout" value="Check Out" onclick="checkOut()" disabled="disabled" /></p> <p> <img src="images/available_disabled.gif" alt="Available" /> = Available; <img src="images/mine_disabled.gif" alt="Mine" /> = Mine; <img src="images/taken_disabled.gif" alt="Taken" /> = Taken</p> </div></div> <div id="seating"><h4>Raised Premium Seating</h4><h6></h6> <table id="tableA"> <tr> <td colspan="7">A</td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td></td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td colspan="7"></td> </tr> <tr> <td colspan="7">B</td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td></td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td colspan="7"></td> </tr> <tr> <td colspan="7">C</td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td></td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td colspan="7"></td> </tr> </table> <h6></h6> <table id="cheap_seats"><h4>Regular Joe Seats</h4> <tr> <td>D</td><td></td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td></td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td></td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td></td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> </tr> <tr> <td>E</td><td></td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td></td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td></td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td></td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> <td> <a href="#nogo"> <img src="images/available.gif" style="border:none" /> </a> </td> </tr> </table> <h5></h5> <div style="clear:both"> </div> <br /> <div id="theButtons"> <input type="button" value="Confirm Choices" id="confirm" onclick="confirmChoices()" /> <input type="reset" value="Reset" onclick="resetAll()" /> </div> </div> </div> </body> </html> any help would be much appreciated! thanks! Similar TutorialsHello, We are conducting a ceremony in an Auditorium where 336 People are gathered and afterwards we want to choose 20 of them randomly. We want to display the whole act of choosing them via projectors on the auditorium screen with a little animation. Basically the concept of the animation goes like this: http://summercampdubai.com , but we are stuck on the code as none of us knows programming that much: we want the chairs to be GRAY and the one that miss the opportunity (randomly) to turn RED (this much we have done) and the last chair (winner) to REMAIN GRAY (this is where we are stuck)r. PS. can anybody help us with this by tomorrow 10:00 AM GMT? Regards, Sara Hi there, I am attempting to set up a very basic menu to drive a program for two different games. I need the menu to process using a primed sentinel controlled loop (where the quit option is the sentinel). I have already set up a function for each game and was hoping to call the function when the user selects a game. I also want to both (a) keep a count of the number of games played and (b) keep a points score, which is to be displayed before the menu is shown agin. When the user quits, I want the final number of points and games played written to document body. I have only very basic knowledge of JavaScript so I realise this is probably a simple answer but I've spent a heap of time on it so far and the menu still has glitches. Any help would be greatly appreciated! This is what I have so far: SENTINEL = 0; MESSAGE_MENU = 'Menu: 1. Pattern Game, 2. Guessing Game, 0. Quit' userInput = parseInt(prompt(MESSAGE_MENU)); while(userInput != SENTINEL) { userInput = parseInt(prompt(MESSAGE_MENU)); if(userInput == 1) { patternGame(); gamesPlayed++; alert('Number of Games Played: '+gamesPlayed) alert('Total Points Scored: '+totalPoints) } else if(userInput == 2) { guessingGame(); gamesPlayed++; alert('Number of Games Played: '+gamesPlayed) alert('Total Points Scored: '+totalPoints) } else { alert('Not a valid input. '+MESSAGE_MENU); } } document.writeln('Total Points: '+totalPoints); document.writeln('Games Played: '+gamesPlayed); Hi All, I need to create a page that is in a sense a Payment Calculator. What it needs to do is take a balance and divide it by a user selected number of months and then display how much must be paid each month to pay off the balance in that time period. How would i set this up to work dynamically so if they decide they want a different number of months it will allow them to change it? I would appreciate any help provided! Thanks Justin Hello! I am trying to find a script that allows you to open multiple browser tabs and then close each of those tabs, either one by one or all at once. Does anyone know how to do this please? Thanks so much for your help. I want to have another go at Javascript. I have several books on the subject but I find that my eyesight is a major problem. Therefore I want to try an on-line solution, preferably free. I have Googled, but there are so many that I am almost dizzy with the choices. Perhaps someone could recommend one. Not too fussy visually. My knowledge is VERY basic. Frank Does anyone know how to make URL links that use Javascript still work when users have Javascript disabled on their browser? The only reason I'm using JS on a URL is because my link opens a PDF file, and I'm forcing it not to cache so users have the latest version. I tried the <script><noscript> tags, but I'm not sure if I'm using it correctly, as my URL completely disappears. Below is my HTML/Javascript code: <p class="download"> <script type="text/javascript">document.write("<span style=\"text-decoration: underline;\"><a href=\"javascript:void(0);\" onclick=\"window.open( 'http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf?nocache='+ Math.floor( Math.random()*11 ) );\" >The Child Magazines Media Kit</a></span> (PDF 1 MB) ");</script> <noscript><span style="text-decoration: underline;"><a href="http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf" >The Child Magazines Media Kit</a></span> (PDF 1 MB)</noscript> </p> Thanks for any help, Michael Hi, I have the following code snippet: test.html ====== <script language="javascript" type="text/javascript"> var testVariable = "test"; </script> <script language="javascript" type="text/javascript" src="test.js"> </script> test.js ===== var testVariable = window.top.testVariable; In firefox, I'm able to access testvariable defined within test.html in test.js. But in chrome, test.js couldnot get the window.top.testVariable field defined in test.html. Can any one please let me know how i can make it work in chrome?. Am i missing something here?. Hi Guys, I am new at JavaScript and start to do some tutorials.What I am trying to do here is prompting user to input a name and if the name was valid the page(document) will display with all objects like the button.But if user enter a wrong name then the button will be disabled! I create the following code but it did not work <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> <script language="JavaScript" type=""> function changeColor(){ document.bgColor = "Gray"; } </script> </head> <body> <script language="JavaScript" type="text/javascript"> var person = ""; person = prompt('What is Your Name:'); if (person == "Foo") { document.write("<h1 />Welcome " + person); document.bgColor = "Yellow"; } else { document.write("<h1 />Access Denied!!!!"); document.bgColor = "Red"; document.getElementById("gree").disabled = true; } </script> <div> <p/><input id="gree" type="button" value="Gray " onClick="changeColor();"> </div> </body> </html> as you can see I used the: document.getElementById("gree").disabled = true; but it did not work , could you please give an idea how I can solve this problem? Thanks Hey, I've got to make the values of some textboxes change the co-ordinates of my sprite on a canvas and havent a clue on how to do it, Here is my form with the two textboxes and submit button: <form> x: <input type="text" name="x" /><br /> y: <input type="text" name:"y" /><br /> <input type="submit" value="Submit"/><br /> </form> And i need it so that they change the values of these: //this shows where my sprite will start on the canvas var block_x; var block_y; searched the internet for hours and cant really find anything i understand or works. any help is much appreciated Hi Guys I am trying to modify the functionality of my page. I want to be able to activate this piece of code using another javascript function. This is the code I want to activate: Code: <script type="text/javascript"><!-- $('#button-cart').bind('click', function() { $.ajax({ url: 'index.php?route=checkout/cart/update', type: 'post', data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea, .date_data input[type=\'text\']'), dataType: 'json', success: function(json) { $('.success, .warning, .attention, information, .error').remove(); if (json['error']) { if (json['error']['warning']) { $('#notification').html('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>'); $('.warning').fadeIn('slow'); } for (i in json['error']) { $('#option-' + i).after('<span class="error">' + json['error'][i] + '</span>'); } } if (json['success']) { $('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>'); $('.success').fadeIn('slow'); $('#cart_total').html(json['total']); $('html, body').animate({ scrollTop: 0 }, 'slow'); } } }); }); //--></script> And this is how I want the format of the function to be: function testsession() { if there is a session called 'hiredate' { activate the script above } else { var el = document.getElementById("product_data"); } } I just dont know how to write this in javascript Could you help me if possible please I got an index.php Code: <html> <form action="bacakomik.php" method='post'> <select name="kodekomik"> <option value='../komik1/|23'>Judul Komik1</option> <option value="../komik2/|20">Judul Komik2</option> <option value="../komik3/|10">Juduk Komik3</option> <option value="../komik4/|20">Judul Komik4</option> </select> <input type="submit" /> </form> <?php echo ('<select>'); echo ('<option value= "'.$i.'">'.'Page '.$i.'</option>'); echo ('</select>'); ?> </html> As you can see, each of the option brings specific value "../komik1/|23" komik1 is a directory | is a delimiter 23 is the pages in one chapter and can be considered also as how many images are there on a specific directory This is my bacakomik.php Code: <?php $dirkomik = $_POST['kodekomik']; $exploded = explode("|", $dirkomik); echo ($exploded[0]); //picture directory echo ("<br>"); echo ($exploded[1]); //total page in the comic $pagecount = (int)$exploded[1]; //Take last posted value, process it right away echo ('<FORM name="guideform"> '); echo ('<select name="guidelinks">'); $i=1; do { echo ('<option value= "'.$i.'">'.'Page '.$i.'</option>'); $i= $i+1; }while($i <= $pagecount); //Printing option and select echo ("</select>"); ?> <input type="button" name="go" value="Go!" onClick="document.getElementById('im').src=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value+'.png';"> </FORM> <img src="img0.jpg" id="im"> With the current code on bacakomik.php, I only can change the img src of id "im" in the same directory only. What I want is that the Javascript could "add" the "$exploded[0]" variable so that the picture can be loaded from different directory. Anyone can do this? I believe that the fix should be somewhere on input tag inside OnClick, or do you know where? Anyway, I found this on the net http://p2p.wrox.com/php-faqs/11606-q...avascript.html Please help me to those who can... I want to insert this js snippet Code: function addText(smiley) { document.getElementById('message').value += " " + smiley + " "; document.getElementById('message').focus(); return false; } to a loaded iframe with name&id chtifrm. I can access it & change embed something in its html via using something like: Code: $(parent.chtifrm.document.body).append('<div id=\"smly\" style=\"cursor:pointer;float:left;top:200px;display:none;position:absolute;\"><\/div>'); .... Code: parent.chtifrm.document.getElementById('chatbox_option_disco').style.display == 'none' but how do I insert js in the head of loaded iframe? All -- I have a JavaScript config file called gameSetting.js which contains a bunch of variables which configures a particular game. I also have a shared JavaScript library which uses the variables in gameSetting.js, which I include like so: <script type="text/javascript" src="gameSetting.js" ></script> <script type="text/javascript" src="gameLibrary.js" ></script> In gameSetting.js I have: $(document).ready(function() { // call some functions / classes in gameLibrary.js } in Firefox, Safari, and Chrome, this works fine. However, in IE, when it's parsing gameSetting.js, it complains that the functions that live in gameLibrary.js aren't defined. When it gets to parsing gameLibrary.js, the variables in gameSetting.js are reported as not being defined. I've tried dynamically bootstrapping the gameLibrary file using this function in document.ready for dynamic load... $.getScript("gameLibrary.js"); However, the same problem still happens in IE, where when it parses the files individually it's not taking into context the file/variables that came before, so it's not an out of load order problem. My options a 1) collapsing all the functions in gameLibrary.js and variables in gameSetting.js into one file. However, this is not practical because this is dealing with literally hundreds of games, and having a gameLibrary.js in ONE location for ONE update is what makes most logical sense. 2) figure out a way to get this to work where variables in file1 are accessible to file2 in IE (as it seems they are in other browsers). jQuery seems to be able to have multiple plugins that all refer to the based jQuery-1.3.2.js, so I know there is a way to get this to work. Help appreciated. Nero I wrote a log function that took note of various function calls. Thinking that functions are first class objects, and objects have properties, I made the name of each logged function a property of that function, e.g., brightenInnerPara.name = "brightenInnerPara"; Every browser I tried (Firefox, MSIE, Opera, Chrome, Safari) accepted the assignment, no problem. In Firefox and MSIE, the result was what I wanted: brightenInnerPara.name == "brightenInnerPara" But in the others, the result was: brightenInnerPara.name == null Question 1. Which Javascript is correct here? I favor Firefox and MSIE, not merely because they were willing to give me what I wanted, but also because it makes no sense to accept an assignment statement without throwing an error and then give it a null semantics, like Chrome, Opera, and Safari did. I found a workaround, using assignments like this: brightenInnerPara.prototype.name = "brightenInnerPara"; To my surprise, that worked in every browser. But I don't know why. It seems that such assignments are enough to cause each function to have its own distinct prototype. Question 2. Just how inefficient is my workaround, and why does it work? Hi everyone, I'm trying to generate a drop down list using a supplied xml form with an xsl sheet. Because xsl lacks commands that will allow me to create repetitive <options> I am using javascript. A sample xml file that I am using is bellow. Code: <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="a.xsl"?> <Country> <California> <County>San Diego</County> <County>Los Angeles</County> </California> <Nevada> <County>Reno</County> <County>Las Vegas</County> </Nevada> </Country> The xsl file that I'm using is show below. Code: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head></head> <body> <p>This loaded</p> <form> <select name='County'> <script type="text/javascript"> var i=3; while(i > 0){ document.write("<option><xsl:value-of select='Country/California/County["); document.write(2); document.write("]'/></option>"); i--; } </script> </select> </form> <script type="text/javascript"> var i=3; while(i > 0){ document.write("<xsl:value-of select='Country/California/County["); document.write(2); document.write("]' /> <br />"); document.write("<xsl:value-of select='Country/California/County[2]'/><br />"); i--; } </script> </body> </html> </xsl:template> </xsl:stylesheet> Bassically all I'm trying to do is list the counties under california. My problem is that the javascript will print the list no problem but it only prints san diego even if my xpath index = i, is set to two. When i is set to 2, it should display Los Angeles. The following sample code will display Los Angeles Code: document.write("<xsl:value-of select='Country/California/County[2]' />"); However when the document has i = 1, it should display san diego. Unfortunately when i use i = 2 and write ... Code: document.write("<xsl:value-of select='Country/California/County[" document.write(i); document.write("]' />"); or even Code: document.write("<xsl:value-of select='Country/California/County["); document.write(2); document.write("]' />"); The xsl sheet will display san diego instead. If the code is used without brackets you can see that everything is being displayed correctly ... for instance writting Code: document.write("xsl:value-of select='Country/California/County[" document.write(i); document.write("]' /"); will result in .. Code: xsl:value-of select='Country/California/County[2]' / Why is xsl doing this to me? Help, replace Double with, Quote backlash and double quote. Code: <script language="javascript"> function replace() { // // replace (" Double Quote) with (\") -backlash and double quote var str = frmEditHTML.tarHTMLText.value; str = str.replace('"', '\'') Javascript 'ERROR'... code stops here... // I know that str = str.replace('"', '\'') should work as a javascript \" ignore double quotes with the // backlash but the output does not show that \" it looks like " instead. /// str = str.replace('"', '\"') did'nt work /// frmEditHTML.tarHTMLText.value - needs .. /// to look like .. /// \"Good Morning\" \"Good Afternoon\" \"Good evening\" /// ????? /// since I will be loading a large file into <Textarea ...frmEditHTML.tarHTMLText.value //// I need this replace for that?.. // when do update the changes back to frmEditHTML.tarHTMLText.value frmEditHTML.tarHTMLText.value=str; } </script> <BR> <button onclick="replace()">Reaplace</Button> <form name="frmEditHTML"> <textarea name="tarHTMLText" cols=60 rows=10 style="color: BLUE; background-color: #E8E8E8"> "Good Morning" "Good Afternoon" "Good evening" </textarea> </form> Thank You! I am able to incorporate CSS into the HTML, like this: Code: <tr><td style="background-color:#FFFF00;">test</td></tr> How can I incorporate CSS into javascript? Code: document.writeln("<tr><td style="background-color:#FFFF00;">" + "test" + "</td></tr>"); The javascript code doesn't work or this is it even possible? Thanks Hi All, This is my first ever thread here at CodingForums.com. I am currently doing a Information and Computer Science degree at Birkbeck University, London. Unfortunately, due to the volcanic ash cloud problems, and being stuck in Cyprus because of it, I unfortunately missed the first FOUR lectures of my Javascript module. I have a Tutor Marked Assignment to do, and have been given a bit longer to submit this because of the problems I had getting home to the UK. Can anyone recommend any good JavaScript websites where I can try and bring myself up to speed quickly? Thanks in advance for any help offered. Kind regards, Daz. I have 3 items in menu. For example- Training qualification seminar If I click Training link,it should display the web page of Training in the same page itself,where this menu exist.If I click qualification link,the web page of qualification should be replaced in the same page. similarly for seminar link.Please help.... Hey everyone, could anyone help me with this code please? Code: <script language ="javascript"> function ageCalculator() { var day = parseInt(document.forms[0].inputdate.value); var month = (parseInt(document.forms[0].inputmonth.value)-1); //this is because javascript thinks of january as month 0, so we need to minus the input month to work e.g december in javascript is month 11. var year = parseInt(document.forms[0].inputyear.value); var year; var yourage; var date = new Date(); thisday = now.getDate(); thismonth = (now.getMonth()); thisyear = (now.getFullYear()); { if ((thismonth > month) || (thismont == month & thisday>=year)) {yourage = year} else {yourage = year + 1} alert("As of, "+now+' \n'+", you a " +(thisyear - yourage) + " years old"); } } </script> <form><center> Enter your day of birth <input type="text" name="inputdate" size="2"><br/> Enter your birth Month(1-12)<input type="text" name="inputmonth" size="2"><br/> Enter your 4 digit birth year<input type="text" name="inputyear" size="4" ><br/> <input type="submit" value="submit" onClick="ageCalculator()"><input type="reset" value="reset"></center> </form> i'm pretty new to code and this has got me stumped any help would be appreciated, thanks |