JavaScript - Js Stopwatch To Express An Input Figure
hi,
im new, so hey, great forum. I'm hoping someone can help - Im looking for a js stopwatch that would express a figure input by the end user - so for example the code could ask 'how many calories do you burn an hour' - user inputs 100 They start the stop watch and the stop watch show both the seconds/minutes increasing, but also show the calories increasing as (input="100"/60)/60 can anyone point in the right direction? many thanks Similar Tutorialshi everyone, I am currently working on a stopwatch and I can't for the life of me get it inside this textbox.. Can anyone help with it? no matter what I seem to try it always goes outside of it... Code: <html> <head> <title> stopwatch </title> <script type="text/javascript"> var setT, h, m, s; function startWatch(b){ var ticker=document.getElementById('ticker'); var HH=h<10?'0'+h:h; var MM=m<10?'0'+m:m; var SS=s<10?'0'+s:s; ticker.innerHTML = HH+':'+MM+':'+SS; if(!b){stopWatch();return} s++; if(s==60){s=0;m++} if(m==60){m=0;h++} setT=setTimeout(function(){startWatch(b)},50) } function stopWatch(){ clearTimeout(setT); } function resetWatch(){ h=0; m=0; s=0; startWatch(false) } onload=resetWatch </script> </head> <body> <form action=""> <input type="button" value="start clock" onclick="startWatch(true)"> <input type="button" value="stop clock" onclick="stopWatch()"> <input type="button" value="reset clock" onclick="resetWatch()"> <br> <br> <span id="ticker"></span> <BR> <INPUT type="text" id="ticker"> </form> </body> </html> I've been working on a stopwatch script and being fairly familiar with Javascript I've coded the following... function y() { setTimeout("x()",1000) } function x() { var a=0; var b=0; var c=0; var d=0; for(i=0;i=1;i=i+0); { txtbox1.value=a + b + ":" + c + d; d++; if (d==10); { d=0; c++; } if (c==6); { d=0; c=0; b++; } if (b==10); { d=0; c=0; b=0; a++; } } } </script> <input type="textbox" name="txtbox1"> <input type="button" name="b1" value="Start timer" onclick="y()"> Hi there. I am wanting to create a countdown timer that is based on a SELECT feature. If a user selected 15 MINUTES, the script would know 15 minutes was selected and would prompt start to time down when selected. Or if the user selected 30 MINUTES it would go to countdown from 30 minutes. I would also like a stopwatch feature on there if STOPWATCH was selected. It would also be great if when counting down the background box of the timer turns red to visually show the timer had gone over and start counting back up in minus to show how many minutes/seconds it has gone over. I've looked on good old Google but can't find a code i'm looking for! Thanks Ash Hi guys! I have a simple JavaScript stopwatch that displays the time using an html form with start/reset and clear buttons. Basically I'm making a speed calculator that converts seconds into MPH. All I need it to do is divide whatever the amount of seconds are by 40.91. So instead of it displaying the seconds being counted up (i.e. 2 seconds, would displayed as 20.455 MPH). Does that make sense? JavaScript is not my strong suit, and It's got me stumped. JavaScript: Code: var t=[0, 0, 0, 0, 0, 0, 0, 1]; function ss() { t[t[2]]=(new Date()).valueOf(); t[2]=1-t[2]; if (0==t[2]) { clearInterval(t[4]); t[3]+=t[1]-t[0]; t[4]=t[1]=t[0]=0; disp(); } else { t[4]=setInterval(disp, 43); } } function r() { if (t[2]) ss(); t[4]=t[3]=t[2]=t[1]=t[0]=0; disp(); t[7]=1; } function disp() { if (t[2]) t[1]=(new Date()).valueOf(); t[6].value=format(t[3]+t[1]-t[0]); } function format(ms) { var d=new Date(ms+t[5]).toString() .replace(/.*([0-9][0-9]:[0-9][0-9]:[0-9][0-9]).*/, '$1'); var x=String(ms%1000); while (x.length<3) x='0'+x; d+='.'+x; return d; } function load() { t[5]=new Date(1970, 1, 1, 0, 0, 0, 0).valueOf(); t[6]=document.getElementById('disp'); disp(); } HTML form: Code: <input type='text' id='disp' maxlength=12 readonly /> <button type='button' onclick='ss()' id='butt' data-inline="true">Start/Stop</button> <button type='button' onclick='r()' id='butt2' data-inline="true">Reset</button> Any help is greatly appreciated!!! Hi, I am facing one problem when i am trying to open the outlook express through javascript. Here i am able to open the outlook express with all the data, but when i press enter on any line of the body if the message, it moves 2 lines. Can any body help me to make it to single spacing. The code i have used is given below. sendemail.js Quote: // JScript File function EmailIt(task,issue_id,emailTO,strTitle,strsubsystem,chkAvailableAll,ddlJob,ddlSystem,ddlTester,ddlPr iority,txtDueDate,ddlAssignedTo,ddlStatus) { //win = window.open("...\\Issues\\HTMLPage3.htm"); var daReferrer = document.referrer; //var task = escape(document.URLUnencoded); //var issue_id = document.URLUnencoded.split("="); var email = emailTO; var title = strTitle; var subsystem = strsubsystem; var availableall = chkAvailableAll; var CustomerJob = ddlJob; var System = ddlSystem; var DueDate = txtDueDate; var AssignedTo = ddlAssignedTo; var Priority = ddlPriority; var Tester = ddlTester; var Status = ddlStatus; var subject = "Issue Task number is " + issue_id + " - " + escape(title) ; var body_message = " Your Assigned Task is.%0D " + escape(task); //+ escape("\n") + " :subsystem ===>"+ subsystem + escape("\n") + " :title ===>" + title + escape("\n") + "available all ===>" +availableall; body_message += escape("\n"); body_message += escape("\n"); body_message += " Customer/Job : " + escape(CustomerJob); body_message += escape("\n"); body_message += " Available For All : " + escape(availableall); body_message += escape("\n"); body_message += " System : " + escape(System); body_message += escape("\n"); body_message += " Sub System : " + escape(subsystem); body_message += escape("\n"); body_message += " Title : " + escape(title); body_message += escape("\n"); body_message += " DueDate : " + escape(DueDate); body_message += escape("\n"); body_message += " AssignedTo : " + escape(AssignedTo); body_message += escape("\n"); body_message += " Priority : " + escape(Priority); body_message += escape("\n"); body_message += " Tester : " + escape(Tester); body_message += escape("\n"); body_message += " Status : " + escape(Status); body_message += escape("\n"); //alert("body_message:--> " + body_message); var mailto_link = 'mailto:'+email+'?subject='+subject+'&body='+body_message; //alert("mailto_link: " + mailto_link); win = window.open(mailto_link); if (win && win.open &&!win.closed) win.close(); //window.history.back(-1); } Can any body please help me to come out this problem. Regards, Vimal kumar srivastava Madhepura,India I have a problem with adding new inputs to a form (if and when required), Internet Explorer is fine but in Firefox if any previous input fields are filled when the more button is clicked they get reset to blank. JS: Code: fields = 0; function addInput() { if (fields != 100) { document.getElementById('input').innerHTML += "<input type='text' name='input[]' size='30' />"; fields += 1; } else { document.getElementById('input').innerHTML += "<br />Maximum 100 fields allowed."; document.form.add.disabled=true;} } form: Code: <form action="index.php" method="post"> <div id="input"> <input type="text" name="input[]" size="30" maxlength="15" /> </div> <!-- button --> <div id="more"> <input type="button" onclick="addInput()" name="add" value="More" /> </div> <!-- // button --> <input type="submit" name="submit" value="Submit" /> </form> as usual any help is appretiated .. I am thinking this should be fairly easy but yet I am not getting far. I want to have a form with a single text imput field for a zip code. Depending on which zip code the user enters will determine which url they will be sent to. If they enter a zip code which is not in the script, they would be sent to a default url. I am also assuming this can be accomplished with javascript. Any help is greatly appreciated. <% content_for :scripts do %> <script type="text/javascript"> $(document).ready(function() { $('.list-tag li a').click(function() { division_id = $(this).attr('id'); division_title = $(this).text(); org_id = <%= @current_org.id %>; org_type = "<%= @current_org.class.to_s %>"; divisionSelected(division_id, division_title, org_id, org_type); return false; }); I have a javascript platform that isn't working correctly. IE 8 is complaining about the line in red, and IE 7 is giving me a syntax error for line in green. Anyone have any advice or suggestions? I dont think anyone can write a code for this because i cant find it anywhere.. I keep trying to write javascript but i just cant grasp it.... and my website is really falling behind.. basically THIS SITE'S total price section and the whole construct of the ability to have everything listed like that and work the way it does is what i want... if i could get the simple version of the code used to make that happen i could continue on and write all the rest... just variables and less than i and document.getWhatever is confusing the crap outta me... but like i said earlier i dont expect anyone here can help me so its alright... but if anyone actually can ILL LOVE YOU FOREVER!!!! Hey everyone. I am making a form with some math functions in it. There is one dropdown where depending on the users selection, the formula should be different. Here is the script so far: Code: <script language="javascript"> function calc(form) { // set variables from input names length= eval(form.length.value) cope = eval(form.cope.value) bevel = eval(form.bevel.value) offset1 = eval(form.offset1.value) // formula calculation = (length-cope) + (offset1 / 2) // display calculation in input form.cut.value = calculation } </script> So what I want is: if bevel=B1 and offset1 > 5, then the formula to use will be "calculation = (length-cope) + (offset1 / 2)" else, it will be "calculation = (length-cope)". I have tried to write this in a simple if.. but obviously my javascript skills are lacking, because the form just doesnt do any calculations at all. How do I go about this? Thanks! What in the world is wrong with this? I have been looking at it for hours. Code: $.ajax({ url: "wifitos.html", type: "GET", dataType: "html", error: function(){ $("#loading").html("Error Loading Site. Try again later.");}, beforeSend: function(){ $("#loading").show("fast");}, complete: function(){ $("#loading").hide("fast");}, success: function(html){ $("#panel_content").show("slow"); $("#panel_content").html(html); } }); All the HTML tags are right. It shows the loading properly, but does not return an error and just says loading forever without loading wifitos.html. Help appreciated! FIXED! DON'T REPLY TO THIS THREAD: After hours of trying to figure this out, I find it 10 sec after I post this thread. Go figure. It was because I had a return false before the ajax. All, I have searched and experimented for quite some time to figure out how to read the return value from a function and have some sort of simple error that I suspect all of you will see immediately. I have tried to return a boolean, a string and a number to use a decision variable... Can one of you look at the code below and tell me what I am missing? (I am running this code a a workstation without any web server due to employer restrictions but I am having the same trouble on my development server ...) (I am trying to make a reusable function that will read the URL and let me know if it has a word in it so I can perform some logic.) Any help would be greatly appreciated... Thanks... <html> <head> <title> JS Test 1</title> <script type="text/javascript"> function OnBodyLoadLogic(){ // UrlHandler(); a test peice of code... UrlHandlerBoolean(); if (UrlHandlerBoolean() == true) { alert("This has the value some URL in the URL"); } else { alert("some is not in the URL"); } } function UrlHandler(){ var urlValue = (window.location.host); var urlValueLowerCase = urlValue.toLowerCase(); if (urlValueLowerCase.indexOf("some URL") != -1) { alert("This has the value some URL in the URL"); } else{ alert("some is not in the URL"); } } function UrlHandlerBoolean(){ var urlValue = (window.location.host); var urlValueLowerCase = urlValue.toLowerCase(); if (urlValueLowerCase.indexOf("some URL") != -1) { return true; } else{ return false; } } function load() { alert("Page is loaded"); } </script> </head> <body onload="OnBodyLoadLogic()"> <h3> JS Return Value</h3> <p> This the beginning of the Page. </p> <div> A Test Div <span id="ReturnValueDisplay" >Initial Value</span> </div> </body> </html> when i try to run this it always says INPUT FROM A FILE. a file can have more than one birthday at it will be output also to a file. sorry for my bad english Code: import java.util.*; public class ZodiacSign { public static void main(String[] args) { String sign=""; String element=""; String chineseSign=""; int month, day,year; Scanner c = new Scanner (System.in); System.out.println("Enter day(1-31): "); day = c.nextInt(); System.out.println("Enter month(1-12): "); month = c.nextInt(); System.out.println("Enter year: "); year = c.nextInt(); if((month == 1) && (day <= 20) || (month == 12) && (day >= 22)) { sign = "Capricorn"; } else if((month == 1) || (month == 2) && (day <= 19)) { sign = "Aquarius"; } else if((month == 2) || (month == 3) && (day <= 20)) { sign = "Pisces"; } else if((month == 3) || (month == 4) && (day <= 19)) { sign = "Aries"; } else if((month == 4) || (month == 5) && (day <= 21)) { sign = "Taurus"; } else if((month == 5) || (month == 6) && (day <= 21)) { sign = "Gemini"; } else if((month == 6) || (month == 7) && (day <= 23)) { sign = "Cancer"; } else if((month == 7) || (month == 8) && (day <= 23)) { sign = "Leo"; } else if((month == 8) || (month == 9) && (day <= 23)) { sign = "Virgo"; } else if((month == 9) || (month == 10) && (day <= 23)) { sign = "Libra"; } else if((month == 10) || (month == 11) && (day <= 22)) { sign = "Scorpio"; } else if(month == 12) { sign = "Sagittarius"; } if((sign.equals("Aries"))||(sign.equals("Leo"))||(sign.equals("Sagittarius"))){ element="Fire"; } else if((sign.equals("Taurus"))||(sign.equals("Virgo"))||(sign.equals("Capricorn"))){ element="Earth"; } else if((sign.equals("Gemini"))||(sign.equals("Libra"))||(sign.equals("Aquarius"))){ element="Air"; } else if((sign.equals("Cancer"))||(sign.equals("Scorpio"))||(sign.equals("Pisces"))){ element="Water"; } int x = (1997 - year) % 12; if ((x == 1) || (x == -11)){ chineseSign="Rat"; } else{ if (x == 0){ chineseSign="Ox"; } else{ if ((x == 11) || (x == -1)){ chineseSign="Tiger"; } else{ if ((x == 10) || (x == -2)){ chineseSign="Rabbit"; } else{ if ((x == 9) || (x == -3)){ chineseSign="Dragon"; } else{ if ((x == 8) || (x == -4)){ chineseSign="Snake"; } else{ if ((x == 7) || (x == -5)){ chineseSign="Horse"; } else{ if ((x == 6) || (x == -6)){ chineseSign="Sheep"; } else{ if ((x == 5) || (x == -7)){ chineseSign="Monkey"; } else{ if ((x == 4) || (x == -8)){ chineseSign="Chicken"; } else{ if ((x == 3) || (x == -9)){ chineseSign="Dog"; } else{ if ((x == 2) || (x == -10)){ chineseSign="Pig"; } } } } } } } } } } } } System.out.println("Your Zodiac sign is "+sign+"."); System.out.println("Chinese Zodiac is: "+chineseSign+"."); System.out.println("Element is "+element+"."); } } Need help with the Script below. I got my radio buttons working, however...the rest of my form/webpage now won't appear. Advice? Please. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><!-- InstanceBegin template="/Templates/2009-fs2-ochdes.dwt" codeOutsideHTMLIsLocked="false" --> <!--#include virtual="/global/admin/2009-fs2-site-configuration.shtml" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title></title> <!-- InstanceEndEditable --> <!--#include virtual="/global/ssi/2009-fs2-meta-details.shtml" --> <!--#include virtual="/global/ssi/2009-fs2-meta-standard.shtml" --> <!--#include virtual="/global/ssi/2009-fs2-meta-scripts.shtml" --> <!-- InstanceBeginEditable name="head" --> <script type="text/javascript"> if (window.addEventListener) window.addEventListener('load',init, true); else window.attachEvent('onload',init); function init() { inputs=document.forms.form1.getElementsByTagName('input'); for(i=0;i<inputs.length;i++) if(inputs[i].type.toLowerCase()=='radio') { thisOne = inputs[i]; radio_buttons.push(thisOne); thisOne.onclick=check_visibility; } fieldsets = document.forms.form1.getElementsByTagName('fieldset'); check_visibility(); } function check_visibility() { for(f=0;f<fieldsets.length;f++) { thisFieldset=fieldsets[f]; if(thisFieldset.id==root_fieldset)checkFieldsets.push(thisFieldset); else thisFieldset.style.display="none"; } do { checkFieldset=checkFieldsets.pop();//get an item to check if(typeof checkFieldset=='undefined') continue; inputs=checkFieldset.getElementsByTagName('input'); if(inputs.count==0) continue;//no inputs to check for(i=0;i<inputs.length;i++) { if(inputs[i].type.toLowerCase()!='radio') continue; thisRadio=inputs[i]; if(!thisRadio.checked) continue; //its a radio and its selected! dependants=visibility_dependancies[thisRadio.id]; if(typeof dependants=='undefined') continue; if(dependants.length==0) continue; for(d=0; d<dependants.length;d++) { newlyVisibleFieldset=document.getElementById(dependants[d]); checkFieldsets.push(newlyVisibleFieldset); newlyVisibleFieldset.style.display='block'; } } } while (checkFieldsets.length>0) } var radio_buttons = new Array(); var fieldsets = new Array(); var root_fieldset = 'Facility_Location_set'; var checkFieldsets = new Array(); var visibility_dependancies={ 'Facility_Location_BFR':new Array('BFR_type_set'), 'Facility_Location_BPAS':new Array('BPAS_type_set'), 'Facility_Location_CRES':new Array('CRES_type_set'), 'Facility_Location_GRLD':new Array('GRLD_type_set'), 'Facility_Location_LKMT':new Array('LKMT_type_set'), 'Facility_Location_PAU':new Array('PAU_type_set'), 'Facility_Location_RAC':new Array('RAC_type_set'), 'Facility_Location_SIS':new Array('SIS_type_set') }; </script> <style> fieldset{float:left; margin:0 2px;} label{padding-left:5px;} </style> <style type="text/css"> #TableBorder { border: thin solid #000; } </style> <!-- InstanceEndEditable --> </head> <body> <!--#include virtual="/global/ssi/2009-fs2-accessibility.shtml" --> <div id="page-wrapper"> <!--#include virtual="/global/ssi/2009-fs2-masthead.shtml" --> <!--#include virtual="/global/ssi/2009-fs2-spotlight-navigation.shtml" --> <div id="sidebar-wrapper" class="noprint"> <!--#include virtual="/global/ssi/2009-fs2-site-navigation.shtml" --> </div><!-- CLOSE sidebar-wrapper --> <div id="content-wrapper"> <!--#include virtual="/global/ssi/2009-fs2-contribute1.shtml" --> <!--#include virtual="/global/ssi/2009-fs2-breadcrumb.shtml" --> <!-- InstanceBeginEditable name="content" --> <h1>Report A Facility Maintenance Problem</h1> <!--#if expr="$QUERY_STRING = 'thankyou'" --> <h2>Thank You!</h2> <p>Thank you for reporting a Facility Maintenance Problem. </p> <!--#else --> <div id="contactus"> <form name="form1" id="form1" method="post" action="<!--#echo var='sitescripts' -->email-building-maint.php" /> <div id="emaildetails"> <input type="hidden" name="recipient_cc" value="cc" /> <input type="hidden" name="redirect" value="http://fsweb-ochdes.r6.fs.fed.us/eng/facilities/facility-maintenance-reporting/index.shtml?thankyou" /> <input type="hidden" name="required" value="Name,Phone_Number,email,recipient" /> <input type="hidden" name="subject" value="Facility Maintenance Problem Report" /> </div> <p><strong>* Fields with an asterisk are required</strong></p> <fieldset> <legend>Your Contact Information</legend> <dl> <dt><label for="Name">Your Name *</label></dt> <dd><input class="inputtext" type="text" id="Name" name="Name" /></dd> <dt><label for="Phone_Number">Your Telephone Number *</label></dt> <dd><input class="inputtext" type="text" name="Phone_Number" id="Phone_Number" /></dd> <dt><label for="email">Your Email Address *</label></dt> <dd><input class="inputtext" type="text" name="email" id="email" /></dd> <dt><label for="File_Location">Supporting Documents</label></dt> <p>If you have any supporting documents or shape files, please provide a file path to where it is stored on the network:</p> <dd><input class="inputtext" type="text" name="File_Location" id="File_Location" /></dd> </dl> <p><strong>Privacy Advisory:</strong> Your personal identifying information is being requested. We need this identifying information so that we can provide what you requested, and/or to respond to your comments. Generally, personal identifying information is destroyed after we fill your request. If you do not provide the requested personal information, we will be unable to respond directly to your request or comment.</p> </fieldset> <fieldset> <legend>Facility Site</legend> <p>Please provide the Facility Site:</p> <dl> <dt><label for="recipient">Facility Site*</label></dt> <dd><select class="inputselect" name="recipient" id="recipient"> <option value="" selected="selected">Select One...</option> <option value="bfr">Bend Fort Rock</option> <option value="bpas">Bend Pine Admin. Site</option> <option value="crescent">Crescent</option> <option value="GRLD">Crooked River National Grassland</option> <option value="LKMT">Lookout Mountain</option> <option value="PAU">Paulina</option> <option value="redmond">Redmond Air Center</option> <option value="sisters">Sisters</option> <option value="test">test</option> </select></dd> </dl> </fieldset> <fieldset id='Facility_Location_set'> <legend>Facility Location</legend> <div><input type='radio' name='Facility_Location' value='BFR' id='Facility_Location_BFR' /> Bend Fort Rock</div> <div><input type='radio' name='Facility_Location' value='BPAS' id='Facility_Location_BPAS' /> Bend Pine Admin. Site</div> <div><input type='radio' name='Facility_Location' value='CRES' id='Facility_Location_CRES' /> Crescent</div> <div><input type='radio' name='Facility_Location' value='GRLD' id='Facility_Location_GRLD' /> Crooked River National Grasslands</div> <div><input type='radio' name='Facility_Location' value='LKMT' id='Facility_Location_LKMT' /> Lookout Mountain</div> <div><input type='radio' name='Facility_Location' value='PAU' id='Facility_Location_PAU' /> Paulina</div> <div><input type='radio' name='Facility_Location' value='RAC' id='Facility_Location_RAC' /> Redmond Air Center</div> <div><input type='radio' name='Facility_Location' value='SIS' id='Facility_Location_SIS' /> Sisters</div> </fieldset> <fieldset id='BFR_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='BFR_type' value='Fall River Guard Station' id='BFR_type_Fall River Guard Station' /> Fall River Guard Station</div> <div><input type='radio' name='BFR_type' value='Lavalands Vistor Center' id='BFR_type_Lavalands Vistor Center' /> Lavalands Vistor Center</div> <div><input type='radio' name='BFR_type' value='Lookout' id='BFR_type_Lookout' /> Lookout</div> <div><input type='radio' name='BFR_type' value='Paulina Lake GS' id='BFR_type_Paulina Lake GS' /> Paulina Lake GS</div> <div><input type='radio' name='BFR_type' value='Scott St.' id='BFR_type_Scott St.' /> Scott St.</div> <div><input type='radio' name='BFR_type' value='Snow Creek' id='BFR_type_Snow Creek' /> Snow Creek</div> <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div> <div>Other <input type='text' name='random_text' value='' id='Other' /></div> </fieldset> <fieldset id='BPAS_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='BPAS_type' value='Coolers' id='BPAS_type_Coolers' /> Coolers</div> <div><input type='radio' name='BPAS_type' value='Equipment Storage Bld.' id='BPAS_type_Equipment Storage Bld.' /> Equipment Storage Bld.</div> <div><input type='radio' name='BPAS_type' value='Lab' id='BPAS_type_Lab' /> Lab</div> <div><input type='radio' name='BPAS_type' value='New Office' id='BPAS_type_New Office' /> New Office</div> <div><input type='radio' name='BPAS_type' value='Packing Shed' id='BPAS_type_Packing Shed' /> Packing Shed</div> <div><input type='radio' name='BPAS_type' value='Shop' id='BPAS_type_Shop' /> Shop</div> </fieldset> <fieldset id='CRES_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='CRES_type' value='Crescent Lake G.S.' id='CRES_type_Crescent Lake G.S.' /> Crescent Lake G.S.</div> <div><input type='radio' name='CRES_type' value='Lookout' id='CRES_type_Lookout' /> Lookout</div> <div><input type='radio' name='CRES_type' value='Office Compound' id='CRES_type_Office Compound' /> Office Compound</div> <div><input type='radio' name='CRES_type' value='Rosedale' id='CRES_type_Rosedale' /> Rosedale</div> <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div> <div>Other <input type='text' name='random_text' value='' id='Other' /></div> </fieldset> <fieldset id='GRLD_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='GRLD_type' value='Field Headquarters' id='GRLD_type_Field Headquarters' /> Field Headquarters</div> <div><input type='radio' name='GRLD_type' value='Lookout' id='GRLD_type_Lookout' /> Lookout</div> <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div> <div>Other <input type='text' name='random_text' value='' id='Other' /></div> </fieldset> <fieldset id='LKMT_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='LKMT_type' value='Dispatch' id='LKMT_type_Dispatch' /> Dispatch</div> <div><input type='radio' name='LKMT_type' value='Helibase' id='LKMT_type_Helibase' /> Helibase</div> <div><input type='radio' name='LKMT_type' value='Lamonta' id='LKMT_type_Lamonta' /> Lamonta</div> <div><input type='radio' name='LKMT_type' value='Lookout' id='LKMT_type_Lookout' /> Lookout</div> <div><input type='radio' name='LKMT_type' value='Ochoco R.S.' id='LKMT_type_Ochoco R.S.' /> Ochoco R.S.</div> <div><input type='radio' name='LKMT_type' value='Ranger Rental' id='LKMT_type_Ranger Rental' /> Ranger Rental</div> <div><input type='radio' name='LKMT_type' value='S.O.' id='LKMT_type_S.O.' /> S.O.</div> </fieldset> <fieldset id='PAU_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='PAU_type' value='Cold Spring Rental' id='PAU_type_Cold Spring Rental' /> Cold Spring Rental</div> <div><input type='radio' name='PAU_type' value='Lookout' id='PAU_type_Lookout' /> Lookout</div> <div><input type='radio' name='PAU_type' value='Rager' id='PAU_type_Rager' /> Rager</div> <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div> <div>Other <input type='text' name='random_text' value='' id='Other' /></div> </fieldset> <fieldset id='RAC_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='RAC_type' value='Admin' id='RAC_type_Admin' /> Admin</div> <div><input type='radio' name='RAC_type' value='Air Tanker Base' id='RAC_type_Air Tanker Base' /> Air Tanker Base</div> <div><input type='radio' name='RAC_type' value='Barracks' id='RAC_type_Barracks' /> Barracks</div> <div><input type='radio' name='RAC_type' value='Cache' id='RAC_type_Cache' /> Cache</div> <div><input type='radio' name='RAC_type' value='Paraloft' id='RAC_type_Paraloft' /> Paraloft</div> <div><input type='radio' name='RAC_type' value='RAG' id='RAC_type_RAG' /> RAG</div> <div>Other <input type='text' name='random_text' value='' id='Other' /></div> </fieldset> <fieldset id='SIS_type_set'> <legend>Facility Name</legend> <div><input type='radio' name='SIS_type' value='Allingham' id='SIS_type_Allingham' /> Allingham</div> <div><input type='radio' name='SIS_type' value='Lookout' id='SIS_type_Lookout' /> Lookout</div> <div><input type='radio' name='SIS_type' value='Office Compound' id='SIS_type_Office Compound' /> Office Compound</div> <div><input type='radio' name='SIS_type' value='Portal' id='SIS_type_Portal' /> Portal</div> <div><input type='radio' name='SIS_type' value='Warehouse Compound' id='SIS_type_Warehouse Compound' /> Warehouse Compound</div> <div>Campground Name <input type='text' name='random_text' value='' id='Campground Name' /></div> <div>Other <input type='text' name='random_text' value='' id='Other' /></div> </fieldset> <fieldset> <legend>Maintenance Area</legend> <dl> <dt><label for="Type_of_Error">Problem that you would like to Report *</label></dt> <dd><select class="inputselect" name="Type_of_Error" id="Type_of_Error"> <option value="Select One">Select One ...</option> <option value="Doors/Locks/Gates = Access">Doors/Locks/Gates = Access</option> <option value="Fence">Fence</option> <option value="HVAC">HVAC</option> <option value="Lights">Lights</option> <option value="Restrooms">Restrooms</option> <option value="Windows/Blinds">Windows/Blinds</option> <option value="Other">Other</option> </select></dd> </dl> </fieldset> <fieldset> <legend>Miscellaneous Information</legend> <dl> <dt><label for="Additional_Information">Please Describe the Problem You are Reporting</label></dt> <dd><textarea class="inputtextarea" id="Additional_Information" name="Additional_Information" rows="11" cols="65"></textarea></dd> </dl> </fieldset> <fieldset> <legend>Send Email To Us</legend> <dl> <dt><label for="submit">Submit Form</label></dt> <dd><input class="inputsubmit" type="submit" id="submit" name="submit" value="Let us Know!" /></dd> </dl> </fieldset> </form> </div> <!--#endif --> <!-- InstanceEndEditable --> <!--#include virtual="/global/ssi/2009-fs2-contribute2.shtml" --> </div> <!-- CLOSE content-wrapper --> <!--#include virtual="/global/ssi/2009-fs2-footer.shtml" --> </div> <!-- CLOSE page-wrapper --> </body> <!-- InstanceEnd --></html> Please see the "watching eyes" next to the search box at the top of: http://www.burton.com I am looking to recreate a similar effect for a project, and I cannot figure out what script is running this. I can see there is some CSS and JS associated with this file but I cannot seem to figure out how it works. It seems to be done using x,y coordinates. Any help would be greatly appreciated. Thank you in advance, Jim I'm attempting to integrate a rich-text mail form and use PHPMailer to send HTML email to a Godaddy email account. The rich-text editor script is the WizzyWig one. (Original can be found Here) Location of form: http://www.westmichiganconcerts.com/contact.html Too much code to post here from all the different files involved, so I saved a version of each file as a TXT file, with it's original extention in brackets before it for easier code viewing (with the exception of the contact.html file above: Involved files: [.js]Rich-Text Editor: /scripts/whizzywig_61.txt [.js]File that spawns preview window: /scripts/load.txt [.php]File called by form action: test_mail.txt [.php]PHPMailer: /lib/PHPMailer_v5.1/class.phpmailer.txt [.php]Config file: /config.txt [.inc]Include file: MailClass.inc.txt Basic flow is: Customer goes to the Contact Page, then enters in rich text, and clicks "Preview" - this spawns a new window "DEMO" and writes the contents of the WizzyWig Iframe to a hidden field. From there, the customer can click "Submit", and it send the email to a Godaddy email account. Here's the problem: I've got a .replace command in the load.js file that replaces the double quotes with singles. If left as doubles, it completely breaks the code. When that email is received, all single quotes are backslashed(escaped?) ( \') so only portions of the HTML (that don't use quotes) show up. (examples: Highlight, insert image, insert link, spans, etc) I'm not fluent with Javascript, so I've been beating my head against the wall for 5 days now trying to get this to work. It's time to ask for some help lol. I'm not sure where / and in what file is causing this to break. Sent a test HTML email to the same Godaddy email address to make sure it could recieve HTML emails, and it worked fine. Any help would greatly be appreciated!! ~ John P.S.: I know there's browser issues with FF etc - I'll correct that once I can get the basic functionality of the pages to work Hi people, I am using a drupal module, views slideshow, it displays images on my site, the landscape sized images are showing fine, however the portrait images are not centered but aligned left and they look cramped over to one side, I have tried css and its not working for sure, this is the script, Im sorry but I no absolutely no javascript so if anyone can figure this one out I will owe you one. I guess it will need to check for the largest width in the slideshow and then half this for the centre. the link to the file is here aswell http://www.2shared.com/document/3kyc...slideshow.html // $Id: views_slideshow.js,v 1.1.2.1.2.39 2010/07/01 03:29:08 redndahead Exp $ /** * @file * A simple jQuery SingleFrame Div Slideshow Rotator. */ /** * This will set our initial behavior, by starting up each individual slideshow. */ Drupal.behaviors.viewsSlideshowSingleFrame = function (context) { $('.views_slideshow_singleframe_main:not(.viewsSlideshowSingleFrame-processed)', context).addClass('viewsSlideshowSingleFrame-processed').each(function() { var fullId = '#' + $(this).attr('id'); var settings = Drupal.settings.viewsSlideshowSingleFrame[fullId]; settings.targetId = '#' + $(fullId + " :first").attr('id'); settings.paused = false; settings.opts = { speed:settings.speed, timeoutarseInt(settings.timeout), delayarseInt(settings.delay), sync:settings.sync==1, random:settings.random==1, pause:false, allowPagerClickBubblesettings.pager_hover==1 || settings.pager_click_to_page), prevsettings.controls > 0)?'#views_slideshow_singleframe_prev_' + settings.vss_id:null, nextsettings.controls > 0)?'#views_slideshow_singleframe_next_' + settings.vss_id:null, pagersettings.pager > 0)?'#views_slideshow_singleframe_pager_' + settings.vss_id:null, nowraparseInt(settings.nowrap), pagerAnchorBuilder: function(idx, slide) { var classes = 'pager-item pager-num-' + (idx+1); if (idx == 0) { classes += ' first'; } if ($(slide).siblings().length == idx) { classes += ' last'; } if (idx % 2) { classes += ' odd'; } else { classes += ' even'; } var theme = 'viewsSlideshowPager' + settings.pager_type; return Drupal.theme.prototype[theme] ? Drupal.theme(theme, classes, idx, slide, settings) : ''; }, after:function(curr, next, opts) { // Used for Image Counter. if (settings.image_count) { $('#views_slideshow_singleframe_image_count_' + settings.vss_id + ' span.num').html(opts.currSlide + 1); $('#views_slideshow_singleframe_image_count_' + settings.vss_id + ' span.total').html(opts.slideCount); } }, befo function(curr, next, opts) { // Remember last slide. if (settings.remember_slide) { createCookie(settings.vss_id, opts.currSlide + 1, settings.remember_slide_days); } // Make variable height. if (settings.fixed_height == 0) { //get the height of the current slide var $ht = $(this).height(); //set the container's height to that of the current slide $(this).parent().animate({height: $ht}); } }, cleartypesettings.ie.cleartype == 'true')? true : false, cleartypeNoBgsettings.ie.cleartypenobg == 'true')? true : false } // Set the starting slide if we are supposed to remember the slide if (settings.remember_slide) { var startSlide = readCookie(settings.vss_id); if (startSlide == null) { startSlide = 0; } settings.opts.startingSlide = startSlide; } if (settings.pager_hover == 1) { settings.opts.pagerEvent = 'mouseover'; settings.opts.pauseOnPagerHover = true; } if (settings.effect == 'none') { settings.opts.speed = 1; } else { settings.opts.fx = settings.effect; } // Pause on hover. if (settings.pause == 1) { $('#views_slideshow_singleframe_teaser_section_' + settings.vss_id).hover(function() { $(settings.targetId).cycle('pause'); }, function() { if (settings.paused == false) { $(settings.targetId).cycle('resume'); } }); } // Pause on clicking of the slide. if (settings.pause_on_click == 1) { $('#views_slideshow_singleframe_teaser_section_' + settings.vss_id).click(function() { viewsSlideshowSingleFramePause(settings); }); } // Add additional settings. if (settings.advanced != "\n") { var advanced = settings.advanced.split("\n"); for (i=0; i<advanced.length; i++) { var prop = ''; var value = ''; var property = advanced[i].split(":"); for (j=0; j<property.length; j++) { if (j == 0) { prop = property[j]; } else if (j == 1) { value = property[j]; } else { value += ":" + property[j]; } } // Need to evaluate so true, false and numerics aren't a string. if (value == 'true' || value == 'false' || IsNumeric(value)) { value = eval(value); } else { // Parse strings into functions. var func = value.match(/function\s*\((.*?)\)\s*\{(.*)\}/i); if (func) { value = new Function(func[1].match(/(\w+)/g), func[2]); } } // Call both functions if prop was set previously. if (typeof(value) == "function" && prop in settings.opts) { var callboth = function(before_func, new_func) { return function() { before_func.apply(null, arguments); new_func.apply(null, arguments); }; }; settings.opts[prop] = callboth(settings.opts[prop], value); } else { settings.opts[prop] = value; } } } $(settings.targetId).cycle(settings.opts); // Start Paused if (settings.start_paused) { viewsSlideshowSingleFramePause(settings); } // Pause if hidden. if (settings.pause_when_hidden) { var checkPause = function(settings) { // If the slideshow is visible and it is paused then resume. // otherwise if the slideshow is not visible and it is not paused then // pause it. var visible = viewsSlideshowSingleFrameIsVisible(settings.targetId, settings.pause_when_hidden_type, settings.amount_allowed_visible); if (visible && settings.paused) { viewsSlideshowSingleFrameResume(settings); } else if (!visible && !settings.paused) { viewsSlideshowSingleFramePause(settings); } } // Check when scrolled. $(window).scroll(function() { checkPause(settings); }); // Check when the window is resized. $(window).resize(function() { checkPause(settings); }); } // Show image count for people who have js enabled. $('#views_slideshow_singleframe_image_count_' + settings.vss_id).show(); if (settings.controls > 0) { // Show controls for people who have js enabled browsers. $('#views_slideshow_singleframe_controls_' + settings.vss_id).show(); $('#views_slideshow_singleframe_playpause_' + settings.vss_id).click(function(e) { if (settings.paused) { viewsSlideshowSingleFrameResume(settings); } else { viewsSlideshowSingleFramePause(settings); } e.preventDefault(); }); } }); } // Pause the slideshow viewsSlideshowSingleFramePause = function (settings) { //make Resume translatable var resume = Drupal.t('Resume'); $(settings.targetId).cycle('pause'); if (settings.controls > 0) { $('#views_slideshow_singleframe_playpause_' + settings.vss_id) .addClass('views_slideshow_singleframe_play') .addClass('views_slideshow_play') .removeClass('views_slideshow_singleframe_pause') .removeClass('views_slideshow_pause') .text(resume); } settings.paused = true; } // Resume the slideshow viewsSlideshowSingleFrameResume = function (settings) { $(settings.targetId).cycle('resume'); if (settings.controls > 0) { $('#views_slideshow_singleframe_playpause_' + settings.vss_id) .addClass('views_slideshow_singleframe_pause') .addClass('views_slideshow_pause') .removeClass('views_slideshow_singleframe_play') .removeClass('views_slideshow_play') .text('Pause'); } settings.paused = false; } Drupal.theme.prototype.viewsSlideshowPagerThumbnails = function (classes, idx, slide, settings) { var href = '#'; if (settings.pager_click_to_page) { href = $(slide).find('a').attr('href'); } return '<div class="' + classes + '"><a href="' + href + '"><img src="' + $(slide).find('img').attr('src') + '" /></a></div>'; } Drupal.theme.prototype.viewsSlideshowPagerNumbered = function (classes, idx, slide, settings) { var href = '#'; if (settings.pager_click_to_page) { href = $(slide).find('a').attr('href'); } return '<div class="' + classes + '"><a href="' + href + '">' + (idx+1) + '</a></div>'; } // Verify that the value is a number. function IsNumeric(sText) { var ValidChars = "0123456789"; var IsNumber=true; var Char; for (var i=0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1) { IsNumber = false; } } return IsNumber; } /** * Cookie Handling Functions */ function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else { var expires = ""; } document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length,c.length); } } return null; } function eraseCookie(name) { createCookie(name,"",-1); } /** * Checks to see if the slide is visible enough. * elem = element to check. * type = The way to calculate how much is visible. * amountVisible = amount that should be visible. Either in percent or px. If * it's not defined then all of the slide must be visible. * * Returns true or false */ function viewsSlideshowSingleFrameIsVisible(elem, type, amountVisible) { // Get the top and bottom of the window; var docViewTop = $(window).scrollTop(); var docViewBottom = docViewTop + $(window).height(); var docViewLeft = $(window).scrollLeft(); var docViewRight = docViewLeft + $(window).width(); // Get the top, bottom, and height of the slide; var elemTop = $(elem).offset().top; var elemHeight = $(elem).height(); var elemBottom = elemTop + elemHeight; var elemLeft = $(elem).offset().left; var elemWidth = $(elem).width(); var elemRight = elemLeft + elemWidth; var elemArea = elemHeight * elemWidth; // Calculate what's hiding in the slide. var missingLeft = 0; var missingRight = 0; var missingTop = 0; var missingBottom = 0; // Find out how much of the slide is missing from the left. if (elemLeft < docViewLeft) { missingLeft = docViewLeft - elemLeft; } // Find out how much of the slide is missing from the right. if (elemRight > docViewRight) { missingRight = elemRight - docViewRight; } // Find out how much of the slide is missing from the top. if (elemTop < docViewTop) { missingTop = docViewTop - elemTop; } // Find out how much of the slide is missing from the bottom. if (elemBottom > docViewBottom) { missingBottom = elemBottom - docViewBottom; } // If there is no amountVisible defined then check to see if the whole slide // is visible. if (type == 'full') { return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom) && (elemBottom <= docViewBottom) && (elemTop >= docViewTop) && (elemLeft >= docViewLeft) && (elemRight <= docViewRight) && (elemLeft <= docViewRight) && (elemRight >= docViewLeft)); } else if(type == 'vertical') { var verticalShowing = elemHeight - missingTop - missingBottom; // If user specified a percentage then find out if the current shown percent // is larger than the allowed percent. // Otherwise check to see if the amount of px shown is larger than the // allotted amount. if (amountVisible.indexOf('%')) { return (((verticalShowing/elemHeight)*100) >= parseInt(amountVisible)); } else { return (verticalShowing >= parseInt(amountVisible)); } } else if(type == 'horizontal') { var horizontalShowing = elemWidth - missingLeft - missingRight; // If user specified a percentage then find out if the current shown percent // is larger than the allowed percent. // Otherwise check to see if the amount of px shown is larger than the // allotted amount. if (amountVisible.indexOf('%')) { return (((horizontalShowing/elemWidth)*100) >= parseInt(amountVisible)); } else { return (horizontalShowing >= parseInt(amountVisible)); } } else if(type == 'area') { var areaShowing = (elemWidth - missingLeft - missingRight) * (elemHeight - missingTop - missingBottom); // If user specified a percentage then find out if the current shown percent // is larger than the allowed percent. // Otherwise check to see if the amount of px shown is larger than the // allotted amount. if (amountVisible.indexOf('%')) { return (((areaShowing/elemArea)*100) >= parseInt(amountVisible)); } else { return (areaShowing >= parseInt(amountVisible)); } } } This is for an assignment that I am working on, have figured out most of the code already, I am just having a hard time getting one question. The question is "in the defineMarquee function it says for every item in the marqueeTxt array, store the value of the top style from the CSS style sheet in a variable named topValue. (Hint: To extract the values from the style sheet , use object detection to determine the calculated CSS style value.) After you have calculated a vale for the topValue variable, store that value in the top style property for the current item in the marqueeTxt array." In truth I really don't understand what it is asking, so if someone could help me out with some detail or what I should be looking for. Here is the code i have so far: Code: var timeID; var marqueeTxt = new Array(); var marqueeOff = true; window.onload = defineMarquee; function defineMarquee(){ var allElems = document.getElementsByTagName("*"); for (var i=0; i<allElems.length; i++){ if (allElems[i].className == "marqueeTxt") marqueeTxt.push(allElems[i]); } for (i = 0; i < marqueeTxt.length; i++) { if (window.getComputedStyle) { var topValue = marqueeTxt[i].currentStyle["top"]; } marqueeTxt[0].style.top = topValue + "px"; } document.getElementById("startMarquee").onclick = startMarquee; document.getElementById("stopMarquee").onclick = stopMarquee; } function startMarquee(){ if(marqueeOff == true){ timeID = setInterval("moveText()",50); marqueeOff = false; } } function stopMarquee(){ clearInterval(timeID); marqueeOff = true; } function moveText(){ for(var i=0; i<marqueeTxt.length; i++){ topPos = parseInt(marqueeTxt[i].style.top); if (topPos < -110){ topPos = 700; }else{ topPos = topPos - 1; } marqueeTxt[i].style.top = topPos + "px"; } } I have no idea if that's the only problem but I just can't get the marquee to work and I think that is part of the problem . Thank you in advance for and help. |