JavaScript - Changing File Names
I have just bought a JS animated web template. I made changes to the file names on the splash page (index.html) and 2 landing pages www.keithmacstanton.com/dez Now everything is all messed up. Help
Similar TutorialsHi, I am new to this forum but I am in dire need of help. I am sorry if this isn't they way you normally do things. I read through some of the rules, but it is late and I am in a hurry. Any help would be greatly appreciated. I need the image file names in my array to be shown in the text box. I am not quite sure how to do this. I have been trying for some time but cannot figure it out. Here is my code. <head> <title>Asn4CStartup.htm by Todd Bowman</title> <style type="text/css" > h1, h2, h3 {font-family: 'arial black';} .controls { font-family: 'arial black'; font-size:10pt;} </style> <script type="text/javascript"> /* <![CDATA[ */ // Note: variables declared inside a function // using the var keyword are all local variables. It means that these // variables are only known inside the function. Other functions cannot see // the values. // On the other hand if a variable is declared outside any function, these are global // variables. The values of global variables are available in all other functions. // Other function can change the values of global variables. // Declare a global var n: var n=0; // we will use this global variable to keep track of exactly which element of the array // is being displayed now. When the user clicks Next button, we will add 1 to n and // then display the image file in the nth element of the array // Declare a global array that will contain the names of image files. var imgArray = new Array(); // The following function will be triggered on the onload event of the page. function fillArray() { // alert ("Hello on load"); imgArray[0]="Bus1.jpg"; imgArray[1]="Bus2.jpg"; imgArray[2]="Fam1.jpg"; imgArray[3]="Fam2.jpg"; imgArray[4]="Honey1.jpg"; imgArray[5]="Honey2.jpg"; imgArray[6]="Map1.png"; // for ( i in imgArray) // alert (imgArray[i]); } function showNext() // This function will be triggered on click of the Next button { // alert ("Hello showNext"); // alert(n); n = n+1; //alert (n); if (n > imgArray.length-1) { alert ('You are already on the last image'); n = n-1; } else document.getElementById('imgPic').src='images/'+imgArray[n]; } // end showNext() function showPrevious() // This function will be triggered on click of the Previous button { // alert("Hello Previous"); // alert(n); n = n-1; // alert (n); if (n < 0) { alert ('You are already at the first image'); n = n+1; } else document.getElementById('imgPic').src='images/'+imgArray[n]; } // end showPrevious() function showFirst() //This function will be triggered on click of the First button { // alert (n); if (n == 0) { alert ('You are already on the first image'); } else document.getElementById('imgPic').src='images/'+imgArray[0]; } function showLast() { // alert (n); if (n > imgArray.length-1) { alert ('You are already on the last image'); } else document.getElementById('imgPic').src='images/'+imgArray.length-1; } /* ]]> */ </script> </head> <body onload="fillArray();"> <div> <h1> Asn4CStartup.htm by Mesbah Ahmed </h1> <h2>Windsurf Image Navigation </h2> Name of the image file shown below:   <input type="text" id="imageName" size="20" readonly="readonly" /> <br/><br/> <img id="imgPic" src = "images/Bus1.jpg" alt="picture" width="500px" height="350px" /> <br/> <input type="button" value="Next" class="controls" onclick="showNext();" /> <input type="button" value="Previous" class="controls" onclick="showPrevious();" /> <input type="button" value="First" class="controls" onclick="showFirst();" /> <input type="button" value="Last" class="controls" onclick="showLast();" /> <br/> <p> <img src="http://www.w3.org/Icons/valid-xhtml11.png" alt="Valid XHTML 1.1!" height="31px" width="88px" /> <img src="http://jigsaw.w3.org/css-validator/images/vcss-blue.png" alt="Valid CSS!" height="31px" width="88px" /> </p> </div> </body> </html> I am trying to use JavaScript to change the path to my pics on my web site at the same time that I change the css sheet. I found the code to change the css but I want to change the pic paths at the same timeI got the css changing code from http://javascript.internet.com/css/change-style.html thanks
Hello, I am using javascript to dynamically edit a form and have run into some problems. In this excerpt of code "x" is already defined, "num" is already defined, and "eval(q)" is just pointing to the proper field in the proper form. Code: eval(q).onkeydown=function onkeydown(event) { checkLength(event,x,num,5); }; Now the problem is, it is literally calling the function with "x" and "num" instead of their values. I tried "eval(x)" and "eval(num)" but that literally calls it with that whole statement as the parameter. How can I call this with the actual values inside of x and num? Thank you. I have a function that capitalizes surnames including Scottish surnames, I can't remember where I found it but it has been working perfectly....until recently! The function will uppercase names that start with mc or mac, so mcdonald will become McDonald and macdonald will become MacDonald. The problem is if someone has the surname mack, it comes out as MacK. I think a good fix would be to tell the expression there needs to be at least 2 characters after mc or mac for it to assume it is Scottish but I have no idea how to do it. The code I have so far is Code: var temp = s.value.toLowerCase().replace( /\b((m)(a?c))?(\w)/g, function($1, $2, $3, $4, $5) { if($2){return $3.toUpperCase()+$4+$5.toUpperCase();} return $1.toUpperCase(); }); Can anyone help tweaking what I have please? I'm useless on regular expressions Ok, below is an example of what I am trying to do (it's easier to show than try to explain). Code: var abc1 = "this text "; var abc2 = "that text "; var abc3 = 483967; var xNum = 2; var myNum = "abc"+xNum; alert (myNum); // this gives the expected "abc2" concatCall(); function concatCall() { var newOne = myNum + abc3; //the output I want is "that text 483967" instead of "abc2483967" alert (newOne); } Now in the function, the variable is behaving as it should and I expected that, what I want though is what is commented. Any ideas on how that can be done? I know it has to do with the fact that once the var and string are concatenated, they become a string. What I want to know is the way to convert the string into a variable name that will produce the variable's data instead of the variable name. (for the curious, I have a <ul> that is passing the xNum var to my JS and currently have an else if statement to output the correct data - i'm looking for a way to shorten this code) Hi all, Apologies if this is a lame question, but I could not find an answer. Firstly, I am unable to post full HTML as it is way too long and I don't have a server to upload it to yet. I have a form that accepts a name and DOB and stores it in an array. Later in the form, a layer is triggered. Within this layer the previously enterred name(s) and DOB(s) are retrieved from the array and displayed on screen, with the addition of two extra input text fields. The code within the layer is as follows. As you can see I'm using the loop to add the additional fields, which in itself, does what I want, but may also be the root of my problem. Code: for (i=0;i<40;i++) { if (Array[i][0] != null) { lyrSrc += "<table style='width:600px;'cellspacing=0 cellpadding=0 border=0>" lyrSrc += "<tbody id='table1'>" lyrSrc += "<tr><td> <\/td><\/tr>" lyrSrc += "<tr><td style='width:220px;'>Name:<\/td><td> " + Array[i][0] + "<\/td><\/tr>" lyrSrc += "<tr><td style='width:220px;'>DOB:<\/td><td> " + Array[i][1] + "<\/td><\/tr>" lyrSrc += "<tr><td style='width:220px;'>Text 1:<\/td><td>$<input type=text name=\"txtone\" size=10><\/td><\/tr>" lyrSrc += "<tr><td style='width:220px;'>Text 2:<\/td><td> <select name=\"txttwo\" size=10><\/td><\/tr>" lyrSrc += "<tr><td> <\/td><\/tr>" lyrSrc += "<\/tbody>" lyrSrc += "<\/table>" } } The array is designed to store multiple names/dobs. If more than one name/dob is enterred, what I'm trying to find out is how to append the fieldnames of the two additional text fields so that the fieldnames are unique, as it returns an error if I try to call the field values if there is more than one name/dob in the array. I would appreciate any assistance or points,nudges,pushes in the right direction. I looked at trying to add the extra fields dynamically, but I couldn't get it to work, probably because of the layer(?). cheers. I have a form with several types of checkboxes, and I'm trying to check all but one of them to determine if any of those have been checked. I do not want to check 'all', but I want to see if any of the 'check_' or 'check2_' checkboxes have been checked. There are a variable number of checkboxes, so this is just an example with two of each. Set 1 and Set 2 will always have the same number of checkboxes as each other, though. I'm having trouble getting the function to do this - so any guidance would be appreciated. Code: <script language="JavaScript"> function checkForNone() { checked=false; for (i=0,n=selectForm2.elements.length;i<n;i++) { if (document.selectForm2.getElementById("check_"+String(i)).checked || document.selectForm2.getElementById("check2_"+String(i)).checked ) { checked=true; } } if (checked==true) { alert("OK!"); return true; } else { alert("Please select at least one checkbox."); return false; } } </script> PHP Code: echo " <form name='selectForm2' id='selectForm2'> Overall: <br> <input type='checkbox' name='all' value='' class='resultsAll' id='all'> Set 1: <br> <input type='checkbox' name='check_1' value='01' class='results1' id='check_1'><br> <input type='checkbox' name='check_2' value='02' class='results1' id='check_2'><br> <br> Set 2: <br> <input type='checkbox' name='check2_1' value='01' class='results2' id='check2_1' disabled='true'><br> <input type='checkbox' name='check2_2' value='02' class='results2' id='check2_2'> <br><br> Check for none selected <input type='button' onclick=\"checkForNone();\" /> </form> "; Hi everybody, I have a php file with an almost-standard html form. The not-so-standard part is that the name-attributes of the form elements are dynamically generated as such: PHP Code: <? for($i=0; $i<5; $i++) { ?> <input type="text" name="field_<? echo $i; ?>" /> <? } ?> Now I want to do some javascript validation on the fields, but I'm having a bit of trouble accessing the values of the fields. My current code is as follows: Code: var i = 0; var num = <? echo $step1_sag_faktura_num; ?>; for (i=0; i<num; i++){ window['file_' + i] = document.forms["nyisagform_step2"]["sag_fak_file_" + i].value; } But this doesn't seem to work. It gives no error message. It just validates true. Can somebody tell me a way to do this? I'm no good at javascript and the code above is pieced together by bit I found on the internet. Thanks in advance, deafdigit I have 2 questons. 1) Is there a way for the loop counter to loop while less then [a php variable]? 2) Is there a way to use a counter in the name of the form elements? Example, instead of "switchBox1" use: "switchBoxCounter" instead of "nameaddy1" use: "nameaddyCounter" Code: if(document.form1.switchBox1.checked) { document.form1.nameaddy1.style.backgroundColor = "#E5E5E5"; } else { document.form1.nameaddy1.style.backgroundColor = "#FFFFFF"; } Hello All, I have a form where I ask my users for a comma seperated web site list. I want to make sure this list only contains the host names of URLs without any white spaces Original list: site1.com, http://site2.com, http://www.site3.com,sub.site4.com Edited list: site1.com,site2.com,site3.com,sub.site4.com Currently I have the following to get the comma separated list Code: var list = document.getElementById( "list" ).value ; Can some one please help me with above task I highly appreciate your help or direction. Hello everybody. I am trying to make it so JavaScript changes my form's SELECT to what my PHP session equals. My method has always worked, except for in this instance. I have not been able to come up with an engineering solution to my problem, so turn to fellow coders for help. This collaboration of code is a stripped down version of what I am wanting to do: PHP Code: <?php $_SESSION['service'] = 'C'; ?> <FORM action="" method="post" name="form"> <DIV> <SELECT name="service" onchange="this.form.action = this.value;"> <OPTION value="a/">A</OPTION> <OPTION value="b/">B</OPTION> <OPTION value="c/">C</OPTION> <OPTION value="d/">D</OPTION> </SELECT> <INPUT type="submit" value="OK"> </DIV> </FORM> <SCRIPT type="text/javascript"> document.forms["form"]["service"].value = "<?php echo $_SESSION['service']; ?>"; </SCRIPT> I am not receiving a JavaScript error and I believe the problem is with clashing use of value between the SELECT element and JavaScript instruction, and that the value being that of the OPTION value attribute. The behaviour of this collaboration of code will work; note the differences: PHP Code: <?php $_SESSION['service'] = 'C'; ?> <FORM action="foobar.html" method="post" name="form"> <DIV> <SELECT name="service"> <OPTION>A</OPTION> <OPTION>B</OPTION> <OPTION>C</OPTION> <OPTION>D</OPTION> </SELECT> <INPUT type="submit" value="OK"> </DIV> </FORM> <SCRIPT type="text/javascript"> document.forms["form"]["service"].value = "<?php echo $_SESSION['service']; ?>"; </SCRIPT> Does anyone know a solution to my problem? Hi, I am new to indesign javascript. I need to collect all the style information from an indesign file and i have to display as combo box and the user should seelct the style name. The selected style names i have to list in a seperate text box and when i select okay i have to search some text and replace in the document where this selected style name paragraphs only. This is my requirement. Can anybody help me to do this? Thanks in advance Anil Hi I've got about 40 check-boxes on my 1 form. These check-boxes all have names (obviously) but they are NOT all unique names. The number of UNIQUE names on my form is probably around 8 or 9 (the actual number is NOT important). Because some check-boxes use the same names as other. It's set up this way, please don't ask me to change it, I can't change it. What's the syntax/method for looping through all the names? I was thinking I should do maybe a "for" loop; Code: for (var i = 0; i < fieldName.length; i++) But I don't know how to hold a variable of the unique names to start with. Can someone help please? I'm trying to move a list of names from a textbox (jim;bill;sam;cathy to a listbox. My code so will move the name to listbox but all one line. I need the list the names in the listbox so that can click them one at a time. Please see my code. How can I modify it to fill the list one name per line? function addItem(){ var tb = $get('<%=txtWhoTo.ClientID%>'); var rightListbox = document.getElementById('<%=lstNDisplay.ClientID%>'); if(strText.length > 0){ var nlength = rightListbox.options.length; rightListbox.options[nlength] = new Option(strText, nlength, false, false); } } I don't want remove any names from the listbox till I click the "OK" button and overwrite what is in the textbox. Find it really hard to understand these random variable names and what they are doing, can anyone explain what is going on exactly in the bolded parts. I have a rough idea but the 3 arrays confuse me somewhat im sure the random variable names are pointers and counts but id love to hear an expert explain them for sure thanks if you can help or are willing to take the time Hi, Can someone tell me what I am doing wrong. Script works on the first attachment but not the other two? Code: <script type="text/javascript" language="JavaScript"><!-- function ExtensionsOkay() { var extension = new Array(); var fieldvalue = new Array(); fieldvalue[0] = document.customApp.attachment_1.value; fieldvalue[1] = document.customApp.attachment_2.value; fieldvalue[2] = document.customApp.attachment_3.value; extension[0] = ".doc"; extension[1] = ".docx"; extension[2] = ".txt"; extension[3] = ".pdf"; // No other customization needed. for(var f = 0; f < fieldvalue.length; f++) { var thisext = fieldvalue[f].substr(fieldvalue[f].lastIndexOf('.')); for(var i = 0; i < extension.length; i++) { if(thisext == extension[i]) { return true; } } alert("Your upload field " + f + " contains an unapproved file name."); return false; } } //--></script> I can get this code to take two separate sections of a file which are not beside each other and write them into another file. It always comes up as a single full line of the code instead of the sections I want. The code includes the student number first name last name and three results of assignments. I want the code to write the student number and three results of all the students into a file and then work out the average of the student results. Can you help? Code: try{ while (in.hasNextLine()) { String line = in.nextLine(); out.println( line); int i=0; if(!Character.isDigit(line.charAt(i))) { i++; } studentStringNumber = line.substring(0, i); String stringResult = line.substring(i); studentStringNumber = studentStringNumber.trim(); stringResults = stringResults.trim(); double stringResultsValue = Double.parseDouble(stringResults.trim()); stringResults = in.nextLine(); studentStringNumber = in.nextLine(); studentNumber = Integer.parseInt(studentStringNumber); if(in.hasNextInt()) { int value = in.nextInt(); } results = Double.parseDouble(stringResults); if(in.hasNextDouble()) { double value = in.nextDouble(); } Scanner lineScanner = new Scanner(line); studentStringNumber = lineScanner.next(); while(!lineScanner.hasNextDouble()) { studentStringNumber = studentStringNumber+ " " +lineScanner.next(); } stringResultsValue = lineScanner.nextDouble(); } } I have this script where people can pick a price and pick quataty. i want it to be only one price and let the person input quatity them selves, how can this be done? Thanks in advance Code: <script type="text/javascript"> function calculate_amount() { var subtotal = 0; var hamburger_subtotal = 0; var hamburger = document.myform.hamburger.value; var hamburger_qty = document.myform.hamburger_qty.value; var cheeseburger_subtotal = 0; var cheeseburger = document.myform.cheeseburger.value; var cheeseburger_qty = document.myform.cheeseburger_qty.value; var pst = 0; var gst = 0; var total = 0; //etc... //var chicken_burger; //var fries; //var gravy; //var chili; if (hamburger > 0) { hamburger_subtotal = hamburger * hamburger_qty; } subtotal = hamburger_subtotal; // myform -- depends on the name of your actual form, if it does not have one give it one. document.myform.display_hamburger_subtotal.value = hamburger_subtotal; if (cheeseburger > 0) { cheeseburger_subtotal = cheeseburger * cheeseburger_qty; } // myform -- depends on the name of your actual form, if it does not have one give it one. document.myform.display_cheeseburger_subtotal.value = cheeseburger_subtotal; subtotal = subtotal + cheeseburger_subtotal; pst = .07 * subtotal; gst = .05 * subtotal; // you cannot add the values after you call toFixed, so do the total now! total = subtotal + pst + gst; total = total.toFixed(2); subtotal = subtotal.toFixed(2); pst = pst.toFixed(2); gst = gst.toFixed(2); // this is wrong var tax = foo * 1.07; document.myform.display_subtotal.value = subtotal; document.myform.display_pst.value = pst; document.myform.display_gst.value = gst; //total = subtotal += pst += gst; document.myform.display_total.value = total; } </script> // first off this all needs to be wrapped in form tags if you are going to post the values to something. // you need to look up how to name your items, you should have an input type=x with name=y and id=y <form name="myform"> <table width="325"> <tbody> <tr> <th width="144">item</th> <th width="75">price</th> <th width="92">quantity</th> <th width="101">sub-total</th> </tr> <tr align="middle"> <td align="left">Hamberger</td> <td><select id="hamburger" name="hamburger" onchange="calculate_amount()"> <OPTION VALUE='2.99'>2.99</OPTION> <OPTION VALUE='3.99'>$.99</OPTION> <OPTION VALUE='4.99'>4.99</OPTION> </select> </td> <td><select id="hamburger_qty" name="hamburger_qty" onchange="calculate_amount()"> <OPTION VALUE='0'>0</OPTION> <OPTION VALUE='1'>1</OPTION> <OPTION VALUE='2'>2</OPTION> <OPTION VALUE='3'>3</OPTION> <OPTION VALUE='4'>4</OPTION> <OPTION VALUE='5'>5</OPTION> <OPTION VALUE='6'>6</OPTION> <OPTION VALUE='7'>7</OPTION> <OPTION VALUE='8'>8</OPTION> <OPTION VALUE='9'>9</OPTION> </select> </td> <td><input type="text" id="display_hamburger_subtotal" name="display_hamburger_subtotal" size="10" disabled="disabled" /></td> </tr> <td align="left">Cheeseberger</td> <td><select id="cheeseburger" name="cheeseburger" onchange="calculate_amount()"> <OPTION VALUE='3.99'>3.99</OPTION> <OPTION VALUE='4.99'>4.99</OPTION> <OPTION VALUE='5.99'>5.99</OPTION> </select> </td> <td><select id="cheeseburger_qty" name="cheeseburger_qty" onchange="calculate_amount()"> <OPTION VALUE='0'>0</OPTION> <OPTION VALUE='1'>1</OPTION> <OPTION VALUE='2'>2</OPTION> <OPTION VALUE='3'>3</OPTION> <OPTION VALUE='4'>4</OPTION> <OPTION VALUE='5'>5</OPTION> <OPTION VALUE='6'>6</OPTION> <OPTION VALUE='7'>7</OPTION> <OPTION VALUE='8'>8</OPTION> <OPTION VALUE='9'>9</OPTION> </select> </td> <td><input type="text" id="display_cheeseburger_subtotal" name="display_cheeseburger_subtotal" size="10" disabled="disabled" /></td> </tr> <tr align="middle"> <td align="left">Chicken Burger</td> <td><input size="7" value="$4.99" /></td> <td><input size="3" /></td> <td><input size="10" /></td> </tr> </tbody> </table> <table width="324"> <tbody> <tr> <th width="124">item</th> <th width="42">price</th> <th width="72">quantity</th> <th width="74">sub-total</th> </tr> <tr align="middle"> <td align="left">French Fries</td> <td><input size="7" value="$2.99" /></td> <td><input size="3" /></td> <td><input size="10" /></td> </tr> <tr align="middle"> <td align="left"><input type="checkbox" /> gravy</td> <td><input size="7" value="$0.50" /></td> <td><input size="3" /></td> <td><input size="10" /></td> </tr> <tr align="middle"> <td align="left"><input type="checkbox" /> chilli</td> <td><input size="7" value="$1.99" /></td> <td><input size="3" /></td> <td><input size="10" /></td> </tr> </tbody> </table> <table align="right"> <tbody> <tr> <td>subtotal</td> <td><input type="text" id="display_subtotal" name="display_subtotal" size="10" disabled="disabled" /></td> </tr> <tr> <td>pst 7%</td> <td><input type="text" id="display_pst" name="display_pst" size="10" disabled="disabled" /></td> </tr> <tr> <td>gst 5%</td> <td><input type="text" id="display_gst" name="display_gst" size="10" disabled="disabled" /></td> </tr> <tr> <td>total</td> <td><input type="text" id="display_total" name="display_total" size="10" disabled="disabled" /></td> </tr> <tr> <td colspan="2"><input type="button" value="total up order" /> </td> </tr> </tbody> </table> </form> Code: <img src = "/images/boats/large/my-red-pepper---8019812411a.jpg" width = "690" height = "350" id = "main_image" /> <div id = "gallery_thumbs"> <img src = "/images/nav_left.png" alt = "Back" id = "nav_back" /> <div id = "inner_thumbs"> <div style="width:10000px" id="sliding_thumbs"> <a href = "/images/boats/large/my-red-pepper---8019812411a.jpg" onclick = "document.getElementById('main_image').src=this.href;return false;" ><img src = "/images/boats/gallery_thumbs/my-red-pepper---8019812411a.jpg" /></a> <a href = "/images/boats/large/my-red-pepper---8019812411a.jpg" onclick = "document.getElementById('main_image').src=this.href;return false;" ><img src = "/images/boats/gallery_thumbs/my-red-pepper---8019712411a.jpg" /></a> <a href = "/images/boats/large/my-red-pepper---8019812411a.jpg" onclick = "document.getElementById('main_image').src=this.href;return false;" ><img src = "/images/boats/gallery_thumbs/my-red-pepper---8019412411a.jpg" /></a> <a href = "/images/boats/large/my-red-pepper---8019812411a.jpg" onclick = "document.getElementById('main_image').src=this.href;return false;" ><img src = "/images/boats/gallery_thumbs/my-red-pepper---8019312411a.jpg" /></a> <a href = "/images/boats/large/my-red-pepper---8019812411a.jpg" onclick = "document.getElementById('main_image').src=this.href;return false;" ><img src = "/images/boats/gallery_thumbs/my-red-pepper---8019212411a.jpg" /></a> <a href = "/images/boats/large/my-red-pepper---8019812411a.jpg" onclick = "document.getElementById('main_image').src=this.href;return false;" ><img src = "/images/boats/gallery_thumbs/my-red-pepper---8019512411a.jpg" /></a> <a href = "/images/boats/large/my-red-pepper---8019812411a.jpg" onclick = "document.getElementById('main_image').src=this.href;return false;" ><img src = "/images/boats/gallery_thumbs/my-red-pepper---8019612411a.jpg" /></a> <a href = "/images/boats/large/my-red-pepper---8019812411a.jpg" onclick = "document.getElementById('main_image').src=this.href;return false;" ><img src = "/images/boats/gallery_thumbs/big_my-red-pepper---12411-main.jpg" /></a> </div> </div> Why isn't this working? document.getElementById('main_image').src=this.href;return false; I originally had this: Code: $('#sliding_thumbs a').click(function() { $('#main_image').attr('src',this.href); return false; }) but that didn't work so I put the onclick inline and it still isn't working but I can't fathom why. I have confirmed that the #main_image is being detected correctly (by alerting the src) and that the this.href part contains the url of an image but nothing happens. There is no error and the large image doesn't load in the same window (so the return false part is working!) Hello all, I am new here and have a question about a AP Div I am using as a dropin. It drops in when the page loads and I would like it to only drop in if a visitor clicks a link I designate as the dropin link. Can someone please tell me how to accomplish this? I am pasting in the js file and I will also need to know how to set up the "a href" link to call the dropin! Thanks is advance for any help you may give! Code: // JavaScript Document var ie=document.all var dom=document.getElementById var ns4=document.layers var calunits=document.layers? "" : "px" var bouncelimit=32 //(must be divisible by 8) var direction="up" function initbox(){ if (!dom&&!ie&&!ns4) return crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin scroll_top=(ie)? truebody().scrollTop : window.pageYOffset crossobj.top=scroll_top-250+calunits crossobj.visibility=(dom||ie)? "visible" : "show" dropstart=setInterval("dropin()",50) } function dropin(){ scroll_top=(ie)? truebody().scrollTop : window.pageYOffset if (parseInt(crossobj.top)<100+scroll_top) crossobj.top=parseInt(crossobj.top)+40+calunits else{ clearInterval(dropstart) bouncestart=setInterval("bouncein()",50) } } function bouncein(){ crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits if (bouncelimit<0) bouncelimit+=8 bouncelimit=bouncelimit*-1 if (bouncelimit==0){ clearInterval(bouncestart) } } function dismissbox(){ if (window.bouncestart) clearInterval(bouncestart) crossobj.visibility="hidden" } function truebody(){ return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body } window.onload=window.setTimeout(initbox,5000); |