Results 1 to 7 of 7

Thread: Basic Syntax Question

  1. #1
    Join Date
    Jul 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Basic Syntax Question

    I have a length field that works fine in my Javascript program but it's really long and unwieldly. So I tried to assign a short variable name to it but MS IE doesn't like my statement (something about NaN, which I know means "not a number"). Does anyone see anything wrong with coding . . . . .
    var tablelen = document.SlideShow.SelectTable.length;
    (The length is the total number of entries in a SELECT table)
    Thanks.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Quick guess... is "SlideShow" the name of the slideshow or should you specify it?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    What on Earth is a "SELECT table?" Also, where have you defined document.SlideShow?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Yes, that is precious little code for us to be able to tell what the trouble is:

    Please post a link to the page on your site that contains the problematic script so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jul 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John,

    I haven't uploaded the code to my Web site yet because it's not quite finished but here are the applicable parts of the code . . .

    var photofolder = 'scans/';
    var tablelen = (document.SlideShow.SelectTable.length);
    function SlideSelected() {
    zoomstat = "Zoom In ";
    document.SlideShow.ZoomButton.value = zoomstat;
    CurrentSlide = document.SlideShow.SelectTable.selectedIndex;
    document.images.ImageWindow.src = (photofolder + document.SlideShow.SelectTable[CurrentSlide].value);
    Message = 'Page pair ' + (CurrentSlide+1) + ' of ' + document.SlideShow.SelectTable.length;
    self.defaultStatus = Message;
    }
    .
    .
    .
    </script>

    </head>
    .
    .
    .
    <form name="SlideShow">
    <table align=center border="0" cellpadding="0">
    <tr>
    <td colspan=2><img name="ImageWindow" border=2></td>
    </tr>
    <tr>
    <td align=left>
    <input type="button" name="ZoomButton"
    value="Zoom In" onClick="Zoom()">
    </td>
    <td align=left width="62%">
    <input type="button" name="Previous"
    value="<<Prev" onClick="ShowSlide(-1)">
    <SELECT name="SelectTable" onChange="SlideSelected();">
    <OPTION value="WIBRFH1976000-001.jpg" selected>Pair 1</OPTION>
    <OPTION value="WIBRFH1976002-003.jpg">Pair 2</OPTION>
    <OPTION value="WIBRFH1976004-005.jpg">Pair 3</OPTION>
    .
    .
    .
    </SELECT>
    <input type="button" name="Next"
    value="Next>>" onClick="ShowSlide(1)">
    </td>

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Now it might be possible for us to figure out. Personally, I would like to see a demo page of the problem though. Without the resources (images and whatever else might go with it) and full 'as is' code and markup, it would require more time than I want to devote.

    If someone else spots the problem and suggest a workable fix, disregard this post.

    Otherwise, please put up a demo page that exhibits the problem and post a link to it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Jul 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I figured out my problem. The var statement was referencing fields it hadn't gotten to yet. So when I moved the statement to my onLoad function, it worked fine. Thanks for looking at it.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •