JavaScript - Hello All How Do I Do The Following Requirement In Javascript?
Requirements:
i Each membership type selected is $20 per month (ie, if all 4 are selected then the monthly program fee is $80) ii if the membership is for 12 months then a 10% discount is applied to the program fee iii a 50% discount is to be applied to the program fee if the applicant is a UTT Student iv a 25% discount is to be applied to the program fee if the applicant is a UTT Staff member v a 15% discount is to be applied to the program fee if the applicant is either a Senior or Student from another school or university Here is what i have done..can you help me with it? Code: <?xml version= "1.0" encoding= "UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtm… <html xmlns= "http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <script type="text/javascript"> total = 0; function ShowPFee(obj) { var price; var i; if (obj.checked) //user must have selected the box total = total + eval(obj.value); else //user must have DEselected the box total = total - eval(obj.value); document.getElementById("gymForm").P… = total; return; } function ShowPFee1(obj) { var df = document.forms["gymForm"], total = 0; var gym = df.MembershipType1, GroupFitness = df.MembershipType2, boxing = df.MembershipType3, tk = df.MembershipType4, months = df.MembershipTerm, pf = df.ProgramFee; if(gym.checked) {total = gym.value * eval(obj.value);} pf.value = total; if(GroupFitness.checked) {total = GroupFitness.value * eval(obj.value);} pf.value = total; if(boxing.checked) {total = boxing.value * eval(obj.value);} pf.value = total; if(tk.checked) {total = tk.value * eval(obj.value);} pf.value = total; return } </script> <link rel="stylesheet" type="text/css" href="practical2.css" /> <title> practical work online gym Form</title> </head> <body> <form name="gymForm" id="gymForm"> <p><b> Membership Type:</b> <input type="checkbox" name="MembershipType1" value="20" onclick="ShowPFee(this)" class="check-1" /> Gym <input type="checkbox" name="MembershipType2" value="20" onclick="ShowPFee(this)" class="check-2" /> Group Fitness <input type="checkbox" name="MembershipType3" value="20" onclick="ShowPFee(this)" class="check-1" /> Boxing <input type="checkbox" name="MembershipType4" value="20" onclick="ShowPFee(this)" class="check-2" /> Taekwondo </p> <p><b> Membership Category:</b> <input type="radio" name="MembershipCategory" value="Uws-Student" class="check-1" /> UTT Student - Student No: <input type="text" name="StudentNo" style="color:black; background-color:white" /> <input type="radio" name="MembershipCategory" value="UTT Staff" class="check-1" /> Uws Staff <input type="radio" name="MembershipCategory" value="Senior" /> Senior <input type="radio" name="MembershipCategory" value="General Public" class="check-1" /> General Public <input type="radio" name="MembershipCategory" value="Student other School/University" /> Student other School/University </p> <p><b> Membership Term: </b> <input type="radio" name="MembershipTerm" value=1 class="check-1" onclick="ShowPFee1(this)" /> 1 Month<input type="radio" name="MembershipTerm" value=6 class="check-2" onclick="ShowPFee1(this)" /> 6 Months <input type="radio" name="MembershipTerm" value=3 class="check-1" onclick="ShowPFee1(this)"/> 3 Months <input type="radio" name="MembershipTerm" value=12 onclick="ShowPFee1(this)" /> 12 Months Similar TutorialsFolks, I have been in IT for many years, but completely new to javascripting and ajax etc. I develop web sites and the php, html coding etc is no issue, its just that I have never needed to do any javascript coding and therefore have not used it at all. Picking it up should present little problem, but as of this moment, I am a complete tyro, and I need to get moving on this requirement ASAP. I have a requirement which I haver never before needed to address. I would be grateful for some pointers to resources (I have searched and searched..... ) which I could use to develop the functionality I need. After that rambling intro, here is the actual issue..... I need to have a variety of areas on a single picture on the website, each of which if clicked on, will go to a different article. Rather than try to explain, here is a link which does a similar thing, although this one is in Flash (which I also don't know): http://www.comcare.gov.au/virtual_wo...fice/reception I need to do pretty much the same thing, though with a different picture and words of course. The website will be a Joomla based site. I hope I have gived enough information, and indeed, hope that I have posted to the right area! Any assistance or thoughts at all would be greatly appreciated. regards to all, Mike i'm using a shopping cart template and i do NOT want to require that shoppers have to enter their email address. how do I disable the requirement, but still ensure if they do type it in, that the format is correct (i.e. person@website.com)? thanks! PHP Code: <?php if(! is_array($alladdresses)){ ?> if(frm.email.value==""){ alert("<?php print $xxPlsEntr?> \"<?php print $xxEmail?>\"."); frm.email.focus(); return (false); } validemail=0; var checkStr = frm.email.value; for (i = 0; i < checkStr.length; i++){ if(checkStr.charAt(i)=="@") validemail |= 1; if(checkStr.charAt(i)==".") validemail |= 2; } if(validemail != 3){ alert("<?php print $xxValEm?>"); frm.email.focus(); return (false); } 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 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. 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 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? 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 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... 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 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? Hello! First, let me say that this is my FIRST attempt at a javascript program so I apologize in advance if what I wrote is . With that said, I'm trying to write some code that checks if a School drop down menu has been changed. If it has, then it should populate a second menu with the correct classes. The first part of my code looks like this: Code: <script type="text/javascript" src="../js/jquery.js"> $('#choose_school').change(function() { if ($(this).val()=='--Select Your School--' { alert('Please select a school from this menu.'); } else { $school = ($(this).val()); <?php $classes = getSchoolClasses($dbRead,$school); ?>}) </script> The menu selection looks like this: Code: <form action="" method="post" name="choose_class"><select name="choose_school" id="choose_school"> <option value = "">--Select Your School--</option> <?php foreach ($schools as $row) { echo "<option value = '{$row['school_id']}'"; echo ">{$row['school_name']}</option>"; } ?> </select> <select name="class_id" id="class_id"> <?php foreach ($classes as $row) { echo "<option value = '{$row['course_id']}'"; echo ">{$row['course_number']}</option>"; } ?></select></form> When I run it I just get a blank screen. So, two questions: 1) Would you happen to notice my error? 2) How does one debug javascript? (I'm using Dreamweaver for the input, which at least seems to catch PHP errors) Many thanks! Hi All, I recently went to interview for Web Developer and got the following questions from my interviewer. I have no idea about how to solve this. Consider a scenario like below: <div id = test></div> <table></table> Given a 5 * 5 table consisting integer data. I need to write a function in JavaScript that reads table in the spiral way (see arrow in the table below to know the spiral ) [0][0]-----------------> [0][5] [1][0]<----------------- [1][5] [2][0]-----------------> [2][5] [3][0]<----------------- [3][5] [4][0]------------------>[4][5] Compute the following in the function 1. Read table in spiral way 2. Sum up the values of row 1 and then calculate the average and put that value in row[2] column 1. 3. For the last row average value put in the div tag defined above in the question Note: Not Allowed to use document.getElementById. Need to use core JavaScript functions. PHP Code: var values = { value1: 6, other: { value2: values.value1 + 1 } } Why can that not work? Is there something like this.parent.value1? I am new to javascript, I need help in completing this project at school HERE IS MY HTML CODE: I need a function to add the radio buttom plus the check boxes when someone click on the total submit buttom. please help me with project. don't worry about my CSS link. thanks <html> <head> <title>pizza online</title> <script type="text/javascript"> /*<![CDATA[ */ function addprice(){ for (var i=0; i <document.forms[0].addsubtotal.legth; ++i) { if (document.forms[0].addsubtotal[i].checked== true) { document.forms[0].addsubtotal[i].checked=false; break; } /* ]]> */ </head> <body> <!-- Your XHTML here --> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="logo" rowspan="3"></td> <td class="topbar"></td> </tr> <tr> <td class="centerbar"><div class="nav_bar">Menu | Order | Location | Coupons</div></td> </tr> <tr> <td class="bottom"></td> </tr> <tr> <td colspan="2" class="nav"></td> </tr> </table> <p> </p> <h3>Order Your Pizza online</h3> <!--begins form--> <form action="FormProcessor.html" name="pizza" method="get" enctype="application/x-www-form-urlencoded" onsubmit="return confirmSubmit()"> <table class="tb" border="0"> <tr> <td class="tb" colspan="5"><h4>Pizzas Selection</h4></td> </tr> <tr> <td class="tb" > </td> <td class="tb2" >Pizzas</td> <td class="" > </td> <td class="tb2" >Price</td> <td class="tb2" >Order Your Pizza online Here</td> </tr> <!--begins radio buttoms--> <tr> <td style="width: 60px;" class="tb"><input type="radio" name="pizza" value="10.99" onclick="addprice();"/></td> <td style="width: 140px;" class="tb">Four Cheese</td> <td style="width: 100px;" > </td> <td style="width: 200px;" class="tb3">$10.99</td> <td rowspan="5" style="width: 500px;" class="tb2" align="center"><img src="image/each1.png" alt="" width="300" height="130" /></td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="radio" name="pizza" value="11.99" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Vegetarian</td> <td style="width: 100px;" > </td> <td style="width: 200px;" class="tb3">$11.99</td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="radio" name="pizza" value="12.99" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Italian</td> <td style="width: 100px;" > </td> <td style="width: 200px;" class="tb3">$12.99</td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="radio" name="pizza" value="13.99" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Chicago</td> <td style="width: 100px;" > </td> <td style="width: 200px;" class="tb3">$13.99</td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="radio" name="pizza" value="14.99" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Deluxe</td> <td style="width: 100px;" > </td> <td style="width: 200px;" class="tb3">$14.99</td> </tr> <tr> <td class="tb" colspan="5"><h4>Toppings Selection</h4></td> </tr> <!--begins check boxes--> <tr> <td style="width: 60px;" class="tb"><input type="checkbox" name="topping" value="1.00" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Pepperoni</td> <td style="width: 100px;" > </td> <td style="width: 100px;" class="tb3">$1.00</td> <td rowspan="5" style="width: 500px;" class="tb">Here is a list of all Topping available for you to choose from. </td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="checkbox" name="topping" value="1.00" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Ham</td> <td style="width: 100px;" > </td> <td style="width: 100px;" class="tb3">$1.00</td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="checkbox" name="topping" value="1.00" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Mushroom</td> <td style="width: 100px;" > </td> <td style="width: 100px;" class="tb3">$1.00</td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="checkbox" name="topping" value="1.00" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Onions</td> <td style="width: 100px;" > </td> <td style="width: 100px;" class="tb3">$1.00</td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="checkbox" name="topping" value="1.00" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Sausage</td> <td style="width: 100px;" > </td> <td style="width: 100px;" class="tb3">$1.00</td> </tr> <tr> <td class="tb" colspan="5"> </td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="checkbox" name="topping" value="1.00" /></td> <td style="width: 140px;" colspan="2"><input type="submit" value="Total" /><input type="reset" value="Reset" /></td> <td style="width: 100px;" class="tb"><input type="text" value="Total" /></td> </tr> </table> </form> <!-- your XHTML validation icon--> </body> </html> Thanks Ossie I designed a simple mobile in html , i want to link it to strings such that.... example : there are numbers from 0 to 9 and when ever i click on a number and then click on another after all the click i made and at last when i click on the " dial" (for example purpose) it should prompt all the numbers in sequence where i click. example to make it clear for my purpose : 1 2 3 4 5 6 7 8 9 * 0 # Dial (button) I clicked on "4" then "6" then "9" and then i hit the "dial" button the it shold show an alert box displaying "469" . I think it isn't a big challenge for you javascript coders. Please post the whole javascript code for this function, also the id's defined to the html separetly by you I am just learning and up on queries , so want your help Thaks a ton I am running a flash detection script which I will include below... It is called by... Code: <script type="text/javascript"> //<![CDATA[ var requiredFlashVersion = 8; var hasFlashURL = 'http://www.*****.org.uk/'; var upgradeFlashURL = document.location.href + "?flash=ug"; var noFlashURL = 'http://www.*****.org.uk/text_version/**********.html'; var dontKnowFlashVersionURL = document.location.href + "?flash=dk"; //]]> </script> <script type="text/javascript" src="flash_detect.js"> //<![CDATA[ function getFlashVersion() { return null; }; //]]> </script> <script type="text/javascript" src="flash_redirect.js"> //<![CDATA[ location.href = dontKnowFlashVersionURL; //]]> </script> as you can see it determines whether the user has flash and refreshes the page with the according url paramater or sends them on their way. The problem I have is that because it refreshes the page the script runs again and again and just readds the url paramater every time... so it keeps refreshing until the url looks like this: index.html?flash=dk?flash=dk?flash=dk?flash=dk?flash=dk. I want a way to make it realise it has done its job and not run after its first service. Everything I have tried such as using an incremental variable has lead to it loading index.html/undefined (I probably executed this wrong). Here is the external js files for the redirection: flash_detect.js Code: // Flash Version Detector v1.2.1 // documentation: http://www.dithered.com/javascript/flash_detect/index.html // license: http://creativecommons.org/licenses/by/1.0/ // code by Chris Nott (chris[at]dithered[dot]com) // with VBScript code from Alastair Hamilton (now somewhat modified) function isDefined(property) { return (typeof property != 'undefined'); } var flashVersion = 0; var count = 0; function getFlashVersion() { var latestFlashVersion = 8; var agent = navigator.userAgent.toLowerCase(); // NS3 needs flashVersion to be a local variable if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) { flashVersion = 0; } if (agent.indexOf("firefox") != -1 && agent.indexOf("msie") == -1) { flashVersion = -2; } // NS3+, Opera3+, IE5+ Mac (support plugin array): check for Flash plugin in plugin array if (navigator.plugins != null && navigator.plugins.length > 0) { var flashPlugin = navigator.plugins['Shockwave Flash']; if (typeof flashPlugin == 'object') { for (var i = latestFlashVersion; i >= 3; i--) { if (flashPlugin.description.indexOf(i + '.') != -1) { flashVersion = i; break; } } } } // IE4+ Win32: attempt to create an ActiveX object using VBScript else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) { var doc = '<scr' + 'ipt language="VBScript"\> \n'; doc += 'On Error Resume Next \n'; doc += 'Dim obFlash \n'; doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n'; doc += ' Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n'; doc += ' If IsObject(obFlash) Then \n'; doc += ' flashVersion = i \n'; doc += ' Exit For \n'; doc += ' End If \n'; doc += 'Next \n'; doc += '</scr' + 'ipt\> \n'; document.write(doc); } // WebTV 2.5 supports flash 3 else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3; // older WebTV supports flash 2 else if (agent.indexOf("webtv") != -1) flashVersion = 2; // Can't detect in all other cases else { flashVersion = flashVersion_DONTKNOW; } return flashVersion; } flashVersion_DONTKNOW = -1; flash_redirect.js Code: // Flash Detection / Redirect v1.1.1 // documentation: http://www.dithered.com/javascript/flash_redirect/index.html // license: http://creativecommons.org/licenses/by/1.0/ // code by Chris Nott (chris[at]dithered[dot]com) // requires: flash_detect.js (http://www.dithered.com/javascript/flash_detect/index.html) // use flash_detect.js to return the Flash version var flashVersion = getFlashVersion(); // Redirect to appropriate page if (flashVersion >= requiredFlashVersion) location.replace(hasFlashURL); else if (flashVersion > 0) location.replace(upgradeFlashURL); else if (flashVersion == -2) location.replace(dontKnowFlashVersionURL); else if (flashVersion == 0) location.replace(noFlashURL); else if (flashVersion == flashVersion_DONTKNOW || flashVersion == null) location.replace(dontKnowFlashVersionURL); Your help is appreciated but please go into detail as I have a minor understanding of Javascript. Edit: Resolved. Instead of using paramaters I changed the anchor and used jquery to search for the string. |