Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by wray

  1. wray

    Output to 2 Decimal Points

    Pre 2.0 Safari doesn't recognize .toFixed() and quietly dies in response. Since toFixed() is the *perfect* solution for this problem you can use prototyping to insert manual formatting in those cases where toFixed() is not supported. if ( !Number.prototype.toFixed ) {...
  2. wray

    Only one function is running

    showhide() toggles the contents of "state", a global variable. Not the same thing as toggling the display state of each specific layer. (If you try three layers the hide mechanism should work for the 1st and 3rd.) To fix your function attach a state variable to each layer or use the display...
  3. wray

    HTML to Text with PERL. Is it possible?

    IE only, the JavaScript to extract the text of an HTML document into a string variable is as simple as -- var s = document.body.innerText; This string can be passed through cgi to Perl for further processing. A quick test shows a cr/lf appended to the text of most individual HTML elements.
  4. wray

    Go ahead... shorten my code!

    In times of yore, in the days before steamships, higher math functions were shunned because of their high cost of computation. A toggle using simple arithmetic: function toggle( i ){ return ( 1 - i ); } works fine as long as the parameter has been initialized as 1 or 0.
  5. wray

    Counting numbers in english

    A deceptively un-simple little challenge. I thought it would be easy enough to make an "English major" optimization -- write a JavaScript solution that doesn't require an enormous amount of decoding to extract the algorithm. Self-documenting, sort of. The English language rules for formulating...
  6. wray

    Site Check in Safari Please

    The script that fails for Safari uses some IE-specific graphic effects -- slideshow1.style.filter="blendTrans(duration=2)"; slideshow1.style.filter="blendTrans(duration=crossFadeDuration1)"; slideshow1.filters.blendTrans.Apply(); Try commenting the effects out, see how Macs like it.
  7. wray

    dynamically insert entity without innerHTML?

    cloneNode() is the best I've come up with so far. <script type="text/javascript"> function showTest() { var oSpan = document.getElementById("nDash"); var oDiv = document.getElementById("testResponse"); oDiv.appendChild(document.createTextNode("This ( ")); oDiv.appendChild(...
  8. wray

    Better way to simulate a count

    Spin counter displays in JavaScript are do-able in the "extreme pain in the ass" sense of the word. If you're not concerned about modeling what's *really* happening inside the program put up an animated gif that looks like a working counter. Simple, reliable, will fool most viewers. BTW, for...
  9. wray

    javascript in perl cgi page

    If there is a server side process creating an activity log, why can't it figure out when the task is done? Assuming the server side process isn't up to the task, how about piggy backing Notification Of Completeness onto whatever mechanism keeps the server log up to date? Or, use the onUnload...
  10. wray

    Need help with parse efficiency

    New to Perl, loving it. My approach to this problem was to use split() a couple of times, tidy up the pieces. while(<LOG>) { ($vIP,$rfc931,$username,$timestamp,$tz, $request,$uri,$protocol,$sc,$size) = split; ($x,$x,$x,$referrer,$x,$uaString) = split(/"/); vIP is visitor IP addy, tz...
  11. wray

    consequetive events + global variables

    The onSubmit event built its alert() message before the global changed state. When the Submit event built its alert() message the global variable was True, but by the time the Submit message finally got to the top of the task queue the global state had changed. Such is asynchronous life...
  12. wray

    How to Get Calendar Week from Date.

    This might work for you. Define Week 1 by plugging in the last day of that week then hand a date to WeekofYear() and get back a week number relative to Week 1. var gWeekMs = 1000 * 60 * 60 * 24 * 7; // initialize to Saturday 3 Jan 2004 var gWeekOneMs = Date.UTC(2004,0,3); var gLastDay...
  13. wray

    Rollover with a twist.

    Try this -- var gSwitch = 1; var agSrc = new Array("Inside01x.jpg","Outside01x.jpg"); function toggle(iSwitch) { return (1 - iSwitch); } function showImage(oImg,iSwitch) { oImg.src = agSrc[iSwitch]; } function changeImage(oImg,iSwitch) { gSwitch = toggle(iSwitch)...
  14. wray

    Rollover with a twist.

    An interesting challenge. Tactical problem: the act11() function references "advan1". There is no "advan1". Strategic problem: the direct reference to specific JPGs by mouseover/out looks like it will undo any switch toggling. Perhaps something like this -- var gSwitch = 1; var agSrc = new...
  15. wray

    Is there a neater way of doing this if/else?

    Dump the constant information into an array indexed by PlantType. When Title is required, ask the array. In JavaScript something like -- var aTitle = new Array(); aTitle[6] = "Cranes"; aTitle[7] = "Excavators"; aTitle[8] = "Dumpers"; aTitle[9] = "Telehandlers"; aTitle[10] = "Compressors"...

Part and Inventory Search

Back
Top