Results 1 to 3 of 3

Thread: Javascript with form, works but shows error in code...?

  1. #1
    Join Date
    Feb 2007
    Location
    Michigan
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Javascript with form, works but shows error in code...?

    I am trying to have a form for sports, if you choose nba, it takes you to a certain iframe... if you choose nhl in the form, it takes you to another address in an iframe... It works and does exactly what I want but in the status bar it shows an error and I am not sure why.. I would really appreciate some guidance with this as I am not very js savvy ... If someone has a suggestion for a better way of doing this I welcome your assistance as well. Code is included below with form as well:

    <tr id="Sports_table">
    <td align="center" bgcolor="#000066" class="$getbgrow"> <form name="jumpy" action="post" style="margin: 0px; padding: 0px;">
    <select onchange="gone();" size="1" name="example">
    <option value="http://www.sportsline.com/nba/box-scoreboards">NBA</option>
    <option value="http://www.sportsline.com/nfl/box-scoreboards">NFL</option>
    <option value="http://www.sportsline.com/nhl/box-scoreboards">NHL</option>
    <option value="http://www.sportsline.com/mlb/box-scoreboards">MLB</option>
    <option value="http://www.sportsline.com/collegefootball/box-scoreboards">NCAA
    Football</option>
    <option value="http://www.sportsline.com/collegebasketball/box-scoreboards" selected="selected">NCAA
    Basketball</option>
    </select>
    </form>
    <font size="1" color="#999999">Courtesy CBS Sportsline</font><br>
    <script type="text/javascript" language="JavaScript">
    var displaymode=0;
    <!-- This adds the iframe -->
    var iframecode="<iframe id='external' style='width: 259px; height: 300px;' src='http://www.sportsline.com/collegebasketball/box-scoreboards' scrolling='auto' border='1' marginwidth='2' marginheight='2' align='center' frameborder='0'></iframe>";
    if (displaymode==0) {
    document.write(iframecode);
    }
    function gone() {
    var selectedurl=document.jumpy.example.options[document.jumpy.example.selectedIndex].value;
    if (document.getElementById&&displaymode==0) {
    document.getElementById("external").src=selectedurl;
    } else if (document.all&&displaymode==0) {
    document.all.external.src=selectedurl;
    } else {
    if (!window.win2||win2.closed) {
    win2=window.open(selectedurl);
    } else {
    win2.location=selectedurl;
    win2.focus();
    }
    }
    }
    </script> </td>
    </tr>
    </table>

  2. #2
    Join Date
    Feb 2007
    Posts
    293
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Your code seems fine. The error in the status bar is coming from the pages that you're bringing into the iframe. Try it by changing the URLs you're bringing in and the error in the status bar will disappear.

  3. #3
    Join Date
    Feb 2007
    Location
    Michigan
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You know, I thought that was the problem the first time I saw it but I got so caught up into debugging (or making an attempt to), that I totally overlooked that idea...

    Thank you for pointing that out...

    On another note, is there a way, or a script other than iframe, perhaps a php include sort of thing that will display the contents I would like, with a form pointing to different pages, that will NOT show an error on my page? Easy for me to say eh.. Basically I want that page's contents, but I do not want my page to show an error as a result from an error in the original page... Hope that makes sense...

    If anyone has any ideas I would really appreciate your help and guidance.

    Thank you,

    StivenUSB

    BTW, if you would like to see the code on my current test page, here is the address: http://www.ultimatesportsbets.com/beta.htm

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
  •