Jump to content

Zerivo

Members
  • Posts

    12
  • Joined

  • Last visited

Posts posted by Zerivo

  1. Hi, i make one but it will be many line same, like this with 20.

    document.getElementById("Test1").value = Dotoff;
    document.getElementById("Test2").value = Dotoff;
    document.getElementById("Test3").value = Dotoff;

    i wonder can it make all id in one? i tried it:
     

    document.getElementById("Test1","Test2","Test3").value = Dotoff;


    but it didn't work well, only Test1 change.
    some know how make all 20 in one? it can save me lots space/line ;)

  2. Quote

    <head><script type="text/javascript">
    function AddInfo() {
    var text="";var txt=""; var IF="";
    var NL=1;var NR=1;
    for (NL = 1; NL < 3; NL++){
    for (NR = 1; NR < 3; NR++){
          if (NR==1) {CR=["T1","C1"]}
     else if (NR==2) {CR=["T2","C2"]}
     else if (NR==3) {CR=["T3","C3"]}
        text += "L"+NL+': '+CR[0]+'&'+CR[1]+"---"; }
    txt += text+"<br>"; }
    document.getElementById("Test").innerHTML = txt; }
    </script></head>
    <body onload="AddInfo()">
    <div id="Test"></div>
    </body>

    filer : loop in loop fail.html

    I was try make loop in loop with array. it should be like:
    L1: T1&C1---L1: T2&C2---L1: T3&C3---
    L2: T1&C1---L2: T2&C2---L2: T3&C3---
    L3: T1&C1---L3: T2&C2---L3: T3&C3---

     

    But I got other than that i thought, so what did i wrong?

  3. Oh i see, last i found own way, cheep and few word ;)

     

    in body i have to add id each option, like that:

     

    <select id="List">
    <option id="O1" value="A1">Cars</option>
    <option id="O2" value="A2">Bike</option>

    <option id="O3" value="A3">Train</option>

    </select>

     

    then in javascript when i press button:

    function Button()

    {

    document.getElementById('O2').innerHTML="Plane";

    }

     

    so it work good :) anyway thank for try help me

  4. Hi i need help for change name in Option when i press button.

    like that code:

    <select id="List">
    <option value="A1">Cars</option>
    <option value="A2">Bike</option>
    <option value="A3">Train</option>
    </select>
    How i change name from "Bike" to "Plane" by press button?
  5. Hi i need help for make sort table

    I want to sort on table, like Shop name, sell type and location etc so if i press button sort location then sort a-z from top to bottom.

    how i can do it? like it:
    <table border="1">
    <tr><td>Shop name</td><td>Type shop</td><td>location </td></tr>
    <tr><td>The Common Defense</td><td>Armor Shop</td><td>New Sorpigal</td></tr>
    <tr><td>The Eagle's Eye</td><td>Weapon Shop</td><td>Castle Ironfist</td></tr>
    <tr><td>Smoke and Mirrors</td><td>Alchemist Shop</td><td>Mire of Damned</td></tr>
    </table>
    so, how i sort those? i try find but hard to found right code.
  6. if i charge it from.
    var B1=A;var B2=A;var B3=A;
    if (A[0]=="T2") {B1[3]=5;}
    if (A[1]=="T2") {B2[3]=5;}
    if (A[2]=="T2") {B3[3]=5;}
    document.getElementById('W1').innerHTML="B1:"+B1[3];
    document.getElementById('W2').innerHTML="B2:"+B2[3];
    document.getElementById('W3').innerHTML="B3:"+B3[3];
    to (those text with bold are charge)
    var B1=A[3];var B2=A[3];var B3=A[3];
    if (A[0]=="T2") {B1=5;}
    if (A[1]=="T2") {B2=5;}
    if (A[2]=="T2") {B3=5;}
    document.getElementById('W1').innerHTML="B1:"+B1;
    document.getElementById('W2').innerHTML="B2:"+B2;
    document.getElementById('W3').innerHTML="B3:"+B3;
    so it work fint, it got 5 on B2 while other got 4. but i want charge other number in array too
    like:
    if (A[0]=="T2") {B1[3]=5;}
    if (A[0]=="T2") {B1[4]=2;}
    if (A[0]=="T2") {B1[5]=5;} etc
    so it save me lots time but it don't work well
  7. Hello i try make it like:

    <html><head> <script type="text/javascript">
    function Code()
    {
    A=["T1","T2","T3",4,2,1];
    var B1=A;var B2=A;var B3=A;
    if (A[0]=="T2") {B1[3]=5;}
    if (A[1]=="T2") {B2[3]=5;}
    if (A[2]=="T2") {B3[3]=5;}
    document.getElementById('W1').innerHTML="B1:"+B1[3]
    document.getElementById('W2').innerHTML="B2:"+B2[3];
    document.getElementById('W3').innerHTML="B3:"+B3[3];
    }
    </script></head><body>
    <input type="button" value="Code it!" onClick="Code()"><br><br><br>
    <div id="W1"></div>
    <div id="W2"></div>
    <div id="W3"></div>
    </body>
    when i press button then i got 5 on all B1, B2 and B3. but it should be only B2 have 5 while other got 4.
    Why it going wrong?
  8. Hello World! I'm just members here for need help my problem code.

     

    oh I'm Zerivo, is 26 year old and from Norway.

    I use language code as hobby, most to website and game (not make game but like wiki, calculator etc)

    I know HTML and Javascript.

×
×
  • Create New...