html compatibility problem

Discussion in 'OT Technology' started by elevator, Mar 26, 2007.

  1. elevator

    elevator The tenants think it's wonderful! ヽ(´ OT Supporter

    Joined:
    Mar 25, 2005
    Messages:
    10,967
    Likes Received:
    0
    Location:
    Houston, TX
    SO, I did this code for an assignment and the prof told me it doesn't work for mozilla/ netscape navigator :squint:
    How does netscape handle this kind of dynamic html?

    PS: I want to change the line in red after input



    <HTML>

    <HEAD><TITLE>onStart</TITLE>

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    var visitorName;
    function start() {
    visitorName = prompt ("Please tell us your name:", "");
    mesg1.innerText = "Thanks for visiting us, " + visitorName + " !";
    }

    // -->
    </SCRIPT></HEAD>
    <BODY ONLOAD="start()">
    <HR>
    <H1>ABC Company</H1>
    <H1 ID="mesg1">Welcome ...</H1>
    <H2>…goodbye…</H2>
    <HR>
    </BODY></HTML>
     
    Last edited: Mar 26, 2007
  2. elevator

    elevator The tenants think it's wonderful! ヽ(´ OT Supporter

    Joined:
    Mar 25, 2005
    Messages:
    10,967
    Likes Received:
    0
    Location:
    Houston, TX
    and I have no idea why it is all on one line...

    edit: fixed
     
  3. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    first: jscript message boxes are so fawking annoying. Don't do it.

    second: why are you not using a server-side scripting language?
     
  4. elevator

    elevator The tenants think it's wonderful! ヽ(´ OT Supporter

    Joined:
    Mar 25, 2005
    Messages:
    10,967
    Likes Received:
    0
    Location:
    Houston, TX
    it's an assignment, i have to follow the isntructions :squint:
     
  5. piratepenguin

    piratepenguin New Member

    Joined:
    Jun 18, 2006
    Messages:
    1,067
    Likes Received:
    0
    Location:
    Ireland
    <SCRIPT LANGUAGE="JavaScript">
    I use: <script type="application/javascript">
     
  6. gnp

    gnp New Member

    Joined:
    Mar 11, 2007
    Messages:
    280
    Likes Received:
    0
    <script type="text/javascript" language="javascript">
    <!--
    var visitorName;
    function start() {
    visitorName = prompt ("Please tell us your name:", "");
    var domElement = document.getElementById("mesg1");
    domElement.innerHTML = "Thanks for visiting us, " + visitorName + " !";
    }
    </script>

    that will work in ie or ns; its kinda kludgey b/c innerHTML shouldn't be used that way, but ie doesn't handle text nodes properly. The other option would be to if (!document.all) sniff.
     
  7. elevator

    elevator The tenants think it's wonderful! ヽ(´ OT Supporter

    Joined:
    Mar 25, 2005
    Messages:
    10,967
    Likes Received:
    0
    Location:
    Houston, TX

    :bowdown: works great, thanks!
     

Share This Page