1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Javascript not working on Firefox

Discussion in 'Scripting & Programming' started by Jakamoko, Aug 24, 2005.

  1. Jakamoko
    Honorary Member

    Jakamoko On the move again ...

    9,915
    60
    229
    Hi Guys,

    If anyone can be bothered, can you please suggest why the following javacript runs in IE but not the Fox ? If I look at the Javascript console in the Fox, it brings up a stream of errors pointing to line 99, but I wouldn't know where to start in debugging this.

    Oh, and btw - I know it's quite a tacky script, but I like it, and it's just a challenge to find out the problem. I plan to use it on my test page at work for uploading to customers' webspace when they swear it's not working, but when in fact they are exercising extreme twattery (thanks Fergal)

    Anyway - here's the page:

    CLICK HERE:

    Thanks Guys :)
     
    Certifications: MCP, A+, Network+
    WIP: Clarity
  2. ffreeloader

    ffreeloader Terabyte Poster

    3,661
    106
    167
    What's it supposed to be? I get nothing but "Gav's Live Test Page" when I open in on a Linux machine running Firefox.
     
    Certifications: MCSE, MCDBA, CCNA, A+
    WIP: LPIC 1
  3. Jakamoko
    Honorary Member

    Jakamoko On the move again ...

    9,915
    60
    229
    Therein lies the crux, Freddy :( You wont see how it's meant to run unless it's viewed in IE (awaits the sound of Freddy gagging at the thought !) It's an on-screen clock.

    It's only an issue because probs 90% of our customers use IE, so that's why I want to know what IE is capable of that Firefox isn't. I'm more just intrigued than anything at this stage :hhhmmm
     
    Certifications: MCP, A+, Network+
    WIP: Clarity
  4. ffreeloader

    ffreeloader Terabyte Poster

    3,661
    106
    167
    My guess is, and I'm not a great html coder but it seems to stick out like a sore thumb:
    That's not industry standard html is it? Wouldn't Firefox choke on that right there and then only display anything that is in the <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> format.

    I would imagine this could only display in IE as MSHTML 6.0 is most likely written explicitly for IE 6 and above. Just a guess though. I'll be interested in seeing how right or wrong I am.
     
    Certifications: MCSE, MCDBA, CCNA, A+
    WIP: LPIC 1
  5. JonnyMX

    JonnyMX Petabyte Poster

    5,239
    211
    236
    Well the good news is that it works fine in IE 7.0 which is what I'm using.
    I wouldn't have thought that the META tag would make it fall over, as you've already made a valid DOCTYPE declaration.

    You can find out for sure by deleting that tag and testing it again. It will work fine without it in IE. It's one of those tags that always apears in generated code but nobody knows wtf it is there for.

    I haven't had chance to trawl through the code yet though.

    I stopped using JavaScript on web pages as it used to cause all kinds of cross-browser/service pack 2 headaches.

    Cool effect though!
     
    Certifications: MCT, MCTS, i-Net+, CIW CI, Prince2, MSP, MCSD
  6. d-Faktor
    Honorary Member

    d-Faktor R.I.P - gone but never forgotten.

    810
    0
    39
    lmao, don't ya just love that proprietary code:

    Code:
    ns=(document.layers);
    ie=(document.all);
    
    
    [B]snip...[/B]
    
    if (ns){
    
    ...
    
    if (ie){
    
    
    [B]snip...[/B]
    
    
    (ns)?window.captureEvents(Event.MOUSEMOVE):0;
    function Mouse(evnt){
    ymouse = (ns)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY;
    xmouse = (ns)?evnt.pageX+ClockFromMouseX:event.x+ClockFromMouseX;
    }
    (ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;
    good luck fixing this one. it's gonna be a complete rewrite if you ask me.
     
  7. JonnyMX

    JonnyMX Petabyte Poster

    5,239
    211
    236
    Having thought about it though, that tag simply indicates that the original script was created using MSHTML which is a Microsoft editor, so I'm not really suprised that it generates code that doesn't work in Firefox...

    I'll have a better look if I get chance today.
     
    Certifications: MCT, MCTS, i-Net+, CIW CI, Prince2, MSP, MCSD
  8. nugget
    Honorary Member

    nugget Junior toady

    7,796
    71
    224
    Jak, maybe you need to use an if else statement,


    var browserName=navigator.appname;
    if (browserName=="Microsoft Internet Explorer")
    {
    <code for ms ie>
    }
    else
    {
    <code for all the rest>
    }

    Don't take my word for it though as I know nothing about JS.
     
    Certifications: A+ | Network+ | Security+ | MCP (270,271,272,290,620) | MCDST | MCTS:Vista
    WIP: MCSA, 70-622,680,685
  9. SimonV

    SimonV Petabyte Poster Administrator

    6,616
    149
    228
    This one works in FF (see attachment), I had to rename the file to a .txt as .js files cant be uploded to the forum for security reasons.

    You can implement it two ways:

    1. call the .js file into your HTML body using:
    Code:
    <script src="clock.js" type="text/javascript"></script>
    making sure that the .js file is in the same dir as the html file, if not just change the src="clock.js" part to reflect the location on the .js file like so src="foldername/clock.js"

    2. Copy the javascript from the .txt file and inset it into script tags into your HTML body:
    Code:
    <script type="text/javascript">[COLOR=Blue]PASTE CODE HERE[/COLOR]</script>
     

    Attached Files:

    Certifications: MOS Master 2003, CompTIA A+, MCSA:M, MCSE
    WIP: Keeping CF Alive...
  10. Jakamoko
    Honorary Member

    Jakamoko On the move again ...

    9,915
    60
    229
    Thanks for all your replies Guys. A bunch of us spent some time poring over this today, with a few suggestions similar to those above. It wasn't till our corporate developer took a look over the code, tried a couple of things, and then announced that "no one uses or likes that traily-cursor pish" that I kind of smelt the coffee and binned the idea, and am replacing it with a straight forward little clock script.

    If I haven't mentioned this before, this is all about me trying to learn new things and try new ideas, so nothing on the site is meant to be any kind of finished article - it's just my current hobby.

    Thanks again to all :)
     
    Certifications: MCP, A+, Network+
    WIP: Clarity
  11. dee1810

    dee1810 Byte Poster

    142
    2
    29
    Hi

    I have just looked at your script and I think It looks ace! Dead impressed :D

    It looks great from a fun point of view.

    I wish I was as talented as you at JavaScript - Where did you learn to code JavaScript and Perl. I know that you have quite a few languages up your sleeve.

    My toddler loves your Ant eater/Armadillo avartar. Fingerprints all over my monitor!LOL :D
     
    Certifications: Foundations, Site Designer & JavaScript
    WIP: Server Admin, and Perl
  12. d-Faktor
    Honorary Member

    d-Faktor R.I.P - gone but never forgotten.

    810
    0
    39
    he learnt it at http://javascript.internet.com/clocks/mouse-trail-clock.html. :twisted:
    sorry jakamoko, i couldn't resist. no disrespect intended. :biggrin
     
  13. dee1810

    dee1810 Byte Poster

    142
    2
    29
    Oh d-Faktor

    You are awful :twisted:

    I can't find anything like that in My Scheidegger JavaScript Folder. LOL

    :hhhmmm :clap

    Thanks for the link, guys!
     
    Certifications: Foundations, Site Designer & JavaScript
    WIP: Server Admin, and Perl
  14. Jakamoko
    Honorary Member

    Jakamoko On the move again ...

    9,915
    60
    229
    I would never ever claim credit for something that was not my own, and as I have only just seen this thread, forgive me not responding sooner. To correct you on one thing, d-faktor - I didn't even "learn it" from anywhere. I simply received an email from a friend with the clock in it, and was able to pull the source code from the page - nothing fancy going on here.

    Thanks for your kind words, dee1810 - but again, my avatar is not my own creation. It was drawn for me by the creators of kid's TV show Yoko, Jakamoko, Toto (used to be on ITV every afternoon when I was still getting my kid after nursery, then school - a luxury I seldom get nowadays, what with working "proper" hours)

    There, that should clear things up for a little while longer :)


    EDIT: In fact, if you've only just clicked my link above today, dee, all you'd see is the static clock I currently use. Do you mean you saw the traily thing previously ? Strange - just that it's not there anymore :hhhmmm
     
    Certifications: MCP, A+, Network+
    WIP: Clarity
  15. ffreeloader

    ffreeloader Terabyte Poster

    3,661
    106
    167
    If I know d-Faktor at all he's gently pulling your leg with his perverse sense of humor, not trying to say anything bad about you. :biggrin It's sort of like my request to see you break your own rules and then punish yourself for doing it.... :twisted:
     
    Certifications: MCSE, MCDBA, CCNA, A+
    WIP: LPIC 1
  16. Jakamoko
    Honorary Member

    Jakamoko On the move again ...

    9,915
    60
    229
    Sure, understand that Freddy - reading my last post back I maybe did sound a bit on the defensive. Not so - I genuinely mean I could not claim credit for something that's not my own :)

    (Besides, you should see me when I DO have something to sing out about !!! ) :rolleyes::biggrin
     
    Certifications: MCP, A+, Network+
    WIP: Clarity
  17. d-Faktor
    Honorary Member

    d-Faktor R.I.P - gone but never forgotten.

    810
    0
    39
    well, i'm new here, so you don't know me so well, and i don't know you so well, but i was indeed, as freddy said, just pulling your leg. :blink
     
  18. dee1810

    dee1810 Byte Poster

    142
    2
    29
    Gav

    To be honest, I saw the clock and the swirly cursor trail at the same time as I posted my comment about it. I have just checked out the link, and it's 10.30am Tuesday.

    I am in Avant Browser, if it helps. :D
    Sorry, If I've started any kind of wind-ups here, I just thought that you had scripted it from scratch.

    Dee1810
     
    Certifications: Foundations, Site Designer & JavaScript
    WIP: Server Admin, and Perl
  19. Jakamoko
    Honorary Member

    Jakamoko On the move again ...

    9,915
    60
    229
    Don't worry Guys - all taken as intended, I can assure you :thumbleft
     
    Certifications: MCP, A+, Network+
    WIP: Clarity
  20. vijay

    vijay New Member

    1
    0
    1
    @SimonV: thanks for the script
     
    Last edited by a moderator: Jan 2, 2015

Share This Page

Loading...