Jump to content

jesh

Members
  • Posts

    2,293
  • Joined

  • Last visited

Posts posted by jesh

  1. FirefoxRocks is answering 3-year-old questions again.
    Haha! It took me a few seconds to understand your comment until I finally noticed that the original posting date was "Apr 13 2006".
  2. Without really playing around with this, it looks like this is where the width is being set:this.divObj.style.width=distancepercent * this.contentwidth +"px"And, because of the name of the variable, and the fact that is it multiplied by the width rather than added, tells me that this script is shrinking/expanding the width by a percentage rather than in absolute pixel increments. This might make my first suggestion a bit difficult. Maybe you could set the div's position to absolute and have the right site anchored rather than the left. Check out this example:

    <html><body><style>#test { background-color: red; width: 400px; height: 400px; position: absolute; right: 0px; }</style><script type="text/javascript">function shrink(){    var div = document.getElementById("test");    div.style.width = (div.offsetWidth * .5) + "px";}</script><button onclick="shrink()">Shrink</button><div id="test">Hello</div></body></html>

  3. edit: I got the no wrap going... All I'm missing is the sliding from the other side.
    Well, changing the width makes the div close from the right since all elements are anchored at the top-left corner. If you want the right side to stay put, you'll have to correspond the changing width with a new left position. For example, if each iteration through the animation changes the width by 2 pixels, you'll have to also move the div 2 pixels to the right to keep the right edge where it is and have the left edge move to the right.
  4. Question: is there a list of the values for the various keys (in the above example, 13 is enter). I'm trying to write a script for Acrobat 6, allowing me to press the space key and have the pdf react as though I had hit the tab key (but only for those fields). If so, please message me or post here. Thank you!
    I know of no such list (Google may help) but when I need to know a code, I typically do this (using the example code above):
    function findKey(evt){ var evt = (evt) ? evt : ((window.event) ? event : null);   if (evt.type == 'keydown')	 {var charCode = (evt.charCode) ? evt.charCode : evt.keyCode;alert(charCode);  // this tells you the code for each key pressed.}

  5. Sorry to butt in here. I've never used Crystal Reports. Do you have to use the Designer to set up your report? Can you programmatically do it in the code instead? Or is the only way to set it up to use the Designer view where it can go in and look at the database structure? If you can programmatically do it, you should be able to specify the columns that your proc is returning even if they come from temporary tables.

  6. Its a lot easier to work with an ArrayList, and a lot more efficient because you only have to loop through the elements of the ArrayList once to generate a random sentence.
    I was referring to multiple runs through the randomizing sequence. If the first time you run it it outputs "cat ate dog hat in the", you may want to add some logic so that the next time the sequence runs "cat ate dog hat in the" isn't output again. I know it's (pseudo-)random and the probability that the same sequence will immediately repeat itself is very low, but some applications may require that no recent sequences repeat themselves.I'm a big fan of ArrayLists though. :)
  7. And wait until you try Firebug, another FF add-on/Extension.
    Yeah, I have to say that since I installed Firebug, I have only ever used the Web Developer extension three or four times. Typically to outline all the images on a page or resize the browser window to a standard size. Otherwise, everything I need is in Firebug.
  8. :)-->
    QUOTE(David B @ Apr 23 2007, 01:25 PM) <{POST_SNAPBACK}>
    So, would the best way to change the cusor from an arrow to the pointer for each image be to give each Image or Cell a class or an id and then specify the cursor with a style sheet?By the way you guy both offer some interesting insight. Thanks
    If all of your images were in an encapsulating div, then you could easily set the cursor with the stylesheet:
    <style type="text/css">#AlbumDisplay img { cursor: pointer; }</style><div id="AlbumDisplay"><img /><img /><img /><img /><img /></div>

  9. The getElementsByTagName returns an array of elements; you wouldn't have to declare tables as an Array first.You might try this to see if it's doing anything:

    var tables = document.getElementsByTagName("table");// should alert the number of table elements on the page.alert(tables.length);

    If the tables[0].style.display = "none" part isn't working, could it be that the script is running before all the elements on the page have been loaded into the DOM? If so, you might try this instead:

    function hideAd(){	var tables = document.getElementsByTagName("table");	tables[0].style.display = "none";}window.onload = hideAd;

  10. If you have multiple tables in your page (I mean, in addition to the one that you want to be rid of) you could assign a special class to each of those tables like this:

    <!-- Table that has the ad--><table></table><!-- tables that you want to keep--><table class="keepme"></table><table class="keepme"></table><table class="keepme"></table>

    Then you can use javascript to loop through all the tables:

    var tables = document.getElementsByTagName("table");for(var i = 0; i < tables.length; i++){	if(tables[i].className != "keepme")	{		tables[i].style.display = "none";	}}

    If, on the other hand, you don't have control over any of the content other than the javascript, and that table is always going to be the first table in the code, you might just try this:

    var tables = document.getElementsByTagName("table");tables[0].style.display = "none";

  11. Whenever I wanted to do something like this, I would think of a number of pixels that I wanted the object to move (kind of like the speed that the object will move) and I would specify a direction that I wanted it to move. Something like this:

    var speed = 15;  // that's 15 pixelsvar direction = 1;

    Then, if I wanted to move the object to the right, I'd add the following to its position:

    var element = document.getElementById("myMover");var position = element.offsetLeft;element.style.left = (position + (speed * direction)) + "px";

    Then, to check if it has gone outside of the boundries that I've set up, I'd do this:

    var MAXLEFT = 10;var MAXRIGHT = 600;var element = document.getElementById("myMover");var position = element.offsetLeft;if(position >= MAXRIGHT){	position = MAXRIGHT;	direction *= -1;}else if (position <= MAXLEFT){	position = MAXLEFT;	direction *= -1;}

    The only thing tricky about the above section is that each time the object oversteps the boundaries, I multiple the direction by -1. If it is moving to the right, direction would be "1", if it is moving to the left, direction would be "-1". Multiplying those numbers by -1 effectively flips the direction.I hope this helps.

  12. Does this differ at all from the asp.NET code that does the same thing? I've been looking, but I can't find asp.NET code...
    Here's how you could send a message in ASP.NET (C#):
    MailMessage message = new MailMessage("mymail@mydomain.com", "someone@somedomain.com");message.Subject = "Sending email with .NET";message.Body = "<h1>This is a message.</h1>";message.IsHtml = true;SmtpClient mailer = new SmtpClient("mail.somedomain.com");mailer.Send(message);

    To further what Yahweh was saying about ASP being a dying language and learning ASP.NET instead, I would only add that you should go the C# route rather than the VB route.

  13. I don't understand it well enough to explain to other people other than to say that computers aren't really able to represent floating point numbers very well. If all you are doing is multiplying by 0.01, you might consider dividing by 100 instead:

    <html><body><script>// outputs 38758.700000000004document.write("3875870 * .01 = " + (3875870 * .01) + "<br />");// outputs 38758.7document.write("3875870 / 100 = " + (3875870 / 100) + "<br />");</script></body></html>

  14. It looks like IE only allows read access to that type property. A work around may be something like this:

    <input type="password" id="pwdfield" value="Sridhar" /><input type="text" id="txtfield" value="" style="display: none;" />

    Then the javascript to show the password would look like this:

    var pwd = document.getElementById("pwdfield");var txt = document.getElementById("txtfield");txt.value = pwd.value;pwd.style.display = "none";txt.style.display = "inline";

×
×
  • Create New...