Results 1 to 8 of 8

Thread: Script won't work when uploaded

  1. #1
    Join Date
    May 2005
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Script won't work when uploaded

    Hi

    I got a script here that i'm using for a search engine

    HTML Code:
        <script> 
        function check(){ 
        val = document.form1.textarea.value; 
        
        switch(val){ 
        case "day of the tentacle":
        case "Day of the Tentacle":
        case "dott":
        case "DOTT":
        case "tentacle":
        case "Tentacle":
        case "Maniac Mansion":
        case "maniac mansion":
        location = 'http://abandonware.hostingzero.com/details/dott/'; 
        break; 
        
        case "the settlers":
        case "The Settlers":
        case "Settlers":
        case "settlers":
        location = 'http://abandonware.hostingzero.com/details/settlers1/'; 
        break;
        
        case "Beneath a Steel Sky":
        case "beneath a steel sky":
        location = 'http://abandonware.hostingzero.com/details/beneathasteelsky/'; 
        break;
        
        case "Genesia":
        case "genesia":
        location = 'http://abandonware.hostingzero.com/details/genesia/'; 
        break;
        
        case "Mortal Kombat 1":
        case "mortal kombat 1":
        location = 'http://abandonware.hostingzero.com/details/mortalkombat1/'; 
        break;
        
        case "Railroad Tycoon Deluxe":
        case "railroad tycoon deluxe":
        location = 'http://abandonware.hostingzero.com/details/railroadtycoondeluxe/'; 
        break;
        
        case "Sim Earth":
        case "sim earth":
        location = 'http://abandonware.hostingzero.com/details/simearth/'; 
        break;
        
        case "Lords of the Realm 1":
        case "lords of the realm 1":
        location = 'http://abandonware.hostingzero.com/details/lordsoftherealm1/'; 
        break;
        
        case "Sam and Max Hit the Road":
        case "sam and max hit the road":
        location = 'http://abandonware.hostingzero.com/details/samandmaxhittheroad/'; 
        break;
        
        case "Loom":
        case "loom":
        location = 'http://abandonware.hostingzero.com/details/loom/'; 
        break;
        
        case "Magic Boy":
        case "magic boy":
        location = 'http://abandonware.hostingzero.com/details/magicboy/'; 
        break;
        
        case "Dragonsphere":
        case "dragonsphere":
        location = 'http://abandonware.hostingzero.com/details/dragonsphere/'; 
        break;
        
        case "Ishar 2":
        case "ishar 2":
        location = 'http://abandonware.hostingzero.com/details/ishar2/'; 
        break;
        
        case "Hemidall 2":
        case "hemidall 2":
        location = 'http://abandonware.hostingzero.com/details/hemidall2/'; 
        break;
        
        case "Lords of the Realm 2":
        case "lords of the realm 2":
        location = 'http://abandonware.hostingzero.com/details/lordsoftherealm2/'; 
        break;
        
        case "The Lion King":
        case "the lion king":
        case "Lion King":
        case "lion king":
        location = 'http://abandonware.hostingzero.com/details/thelionking/'; 
        break;
        
        case "The Jungle Book":
        case "the jungle book":
        case "Jungle Book":
        case "jungle book":
        location = 'http://abandonware.hostingzero.com/details/thejunglebook/'; 
        break;
        
        case "Aladdin":
        case "aladdin":
        location = 'http://abandonware.hostingzero.com/details/aladdin/'; 
        break;
        
        case "Master of Magic":
        case "master of magic":
        location = 'http://abandonware.hostingzero.com/details/masterofmagic/'; 
        break;
        
        	default: 
                 location = 'http://abandonware.hostingzero.com/noresults.shtml'; 
                 break; 
           } 
        } 
        </script> 
        <form name="form1" method="post" action=""> 
          <input name="textarea" type="text" size=11 value=""> 
          <input type=button value="Go" onClick="check();" STYLE="background-color: #000000; color: #ffffff; font-weight: bold; font-size: 5pt;">
        </form>
    It works fine locally but when I upload it doesn't seem to work

    The error says

    'document.form1.textarea' is null or not an object

    Here the link to the page

    http://abandonware.hostingzero.com/screenshots/dott

    Cheers for any help

    gold2040
    Last edited by gold2040; 12-24-2005 at 05:12 PM.

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    First, I would say that that script is not a particularly good idea. It doesn't really search, does it? I would expect to be able to type in "day tentacle" because that should be enough to limit the results, but that would get me nothing. At the very least, you should normalise the case first using the String.prototype.toLowerCase method.

    As for the failure, I can only attribute that to just how badly written the rest of the markup is in the document. Looking at the DOM inspector, the form element in question doesn't exist, presumably because it was removed for some reason during error correction. Rewrite the page (without absolutely-positioning everything in sight, this time), and validate it.

    Not the best of news just before Christmas, I'll grant you, but your best bet to fixing the problem and avoiding any similar problems in the future.

    Mike

  3. #3
    Join Date
    May 2005
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi

    Cheers Mike. I'll see what I can do. Serif WebPlus absolutely positions every page it does I think which is a tad annoying. Do u have any knowledge on the cleaness of Dreamweavers code which i'm thinking of switching to or which editor has the cleanest code

    gold2040

    p.s Do u know how hard it is to hand code a basic search engine or any other good search engine scripts

    sorry for all the questions.just curious

  4. #4
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by gold2040
    Do u have any knowledge on the cleaness of Dreamweavers code [...]
    I've never used it personally, but I do know that the code quality depends entirely upon how it's used. Using it solely in WYSIWYG mode, letting it do the majority of the work, will produce rubbish. If you have sound knowledge of HTML and CSS, then its output will be fine (not least because you can control anything stupid it tries to do).

    [...] or which editor has the cleanest code
    I assume you're still referring to WYSIWYG editors. All of them produce abysmal code unless carefully controlled. Some will still, regardless. It's in the nature of that sort of software.

    Only a human can do a decent job.

    p.s Do u know how hard it is to hand code a basic search engine or any other good search engine scripts
    If I were you, I'd just make sure that your site can be indexed properly, then used an existing remote engine like Google Site Search.

    Mike

  5. #5
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by mwinter
    I assume you're still referring to WYSIWYG editors. All of them produce abysmal code unless carefully controlled. Some will still, regardless. It's in the nature of that sort of software.

    Only a human can do a decent job.
    I'm certainly not disagreeing here, but an interesting tidbit of information - I'm an offical beta tester for MS Office 12, and their new version of Frontpage (now called SharePoint Designer 12) outputs the most coherent code I've ever seen out of a WYSIWYG editor. It's fully XHTML 1.1 and CSS 2.0 compliant.

    It'll be an interesting product to look out for when it's released.
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  6. #6
    Join Date
    May 2005
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi

    Thanks for everyone's help

    I'll take all the advice on board

    gold2040

  7. #7
    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

    Quote Originally Posted by cr3
    . . . new (sic beta) version of Frontpage (now called SharePoint Designer 12) outputs the most coherent code I've ever seen out of a WYSIWYG editor. It's fully XHTML 1.1 and CSS 2.0 compliant.
    You mean MS finally did something right? It could only be because you were onboard.
    - John
    ________________________

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

  8. #8
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1
    You mean MS finally did something right? It could only be because you were onboard.
    *blush*
    I've had to send them about 20 bug reports though. I just click the frowny face and send abuse to them, it's fantastic.



    Word 12 will certainly be a shock to the system though, be warned. It's incredible, but the first time you use it, the interface is so quirky that it makes you want to vomit from overuse of fading. And it can save to PDFs. Finally.

    Wait, what am I doing? Endorsing Microsoft?! Aargh!
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

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
  •