www.webdeveloper.com
Results 1 to 3 of 3

Thread: Firefox not running script..yet again

  1. #1
    Join Date
    Jul 2010
    Posts
    6

    Firefox not running script..yet again

    basically the script below has a form, and when the user submits, the javascript checks the value of the form and removes everything but the file name, makes a fake loading page, and then shows the file name.

    example
    Code:
    "http://facebook.com/home.php" would become "home.php"
    "http://google.com/search.php?term=yahoo.com&color=blue" would become "search.php"
    this works in every browser, (yes including ie), except firefox. anyone se anything wrong?


    Code:
    <html>
    <head>
    <script type="text/javascript">
    function getfilename() {
    var url = document.getElementById('urlinsert').value;
    var lastSlash = url.lastIndexOf("/");
    var firstQuestionMark = url.indexOf("?");
    if(firstQuestionMark == -1)
    {
    firstQuestionMark = url.length;
    }
    var fileName = url.substring(lastSlash + 1, firstQuestionMark);
    content.innerHTML = '<br /><div id="loading"><img src="loading.gif" /></div><div id="download" style="display:none;">download: <a href="http://www.example.com/download.php?file=' + fileName + '">' + fileName + '</a><br /></div><br />';
    setTimeout("document.getElementById('loading').style.display = 'none';", 3000);
    setTimeout("document.getElementById('download').style.display = 'inline';", 3100);
    }
    </script>
    </head>
    <body>
     <input type="text" id="urlinsert" value="paste rapidshare url here" onKeyPress="return disableEnterKey(event)" onFocus="if (this.value == 'paste rapidshare url here') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'paste rapidshare url here';}"></input>
    <a href="#" onClick="getfilename()" class="submit" style="cursor:pointer">submit</a>
    </body>
    </html>

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,655
    Code:
    disableEnterKey is not defined
    [Break on this error]
    
    document.getElementById("loading") is null
    [Break on this error] setTimeout("document.getElementById('loading').style.display = 'none';", 3000);
    (str 14)
    
    document.getElementById("download") is null
    [Break on this error] setTimeout("document.getElementById('download').style.display = 'inline';", 3100);
    (str 15)

  3. #3
    Join Date
    Jul 2010
    Posts
    6
    no i shortened the code to what was neccesary.

    heres the full website
    Code:
    http://www.makeitrock.com/rs.php

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles