Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: input buttons

  1. #1
    New Coder
    Join Date
    Jan 2003
    Location
    Italy
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    input buttons

    Hello

    I’m using a form with input type buttons to create an array (database) each array is separated by the symbol “|”
    I would like to know, how can I change all input buttons to replace “|” into a <br> and maintain all arrays in a single and continuous text string.
    Regards JD

    <INPUT TYPE=button VALUE='Mini /130mm' ONCLICK="this.form.PicDesc.value+='| Flower Size: '+this.value" NAME=Submit14 STYLE="font:8pt verdana">

    MainArray[MainVar++] = new Fix("06/03/2004", "../mem_seedlings/Adam.jpg", "Georgia's Pearl x Rosalind", "Richard_Johnson", "Form: Single,Ruffled,Fringed| Flower Size: Mini /130mm| Texture:Medium| Duration:2-Days| Bloom Presentation:lateral| Body Color: Brown| Eye Zone: Gray | Set Seeds: Yes | Growth Habit Development: Slow Growing | Growth Habit Form: Normally Shaped | Foliage: Heavy | Height: Tall 6-9 ft/1.8-2.7m | Width: as Wide as Height | Propagation: Cutting | Hybridizer Name: Richard Johnson | Photo Credit: Richard Johnson", "adam.jpg", "Lady Cilento.jpg", "Grey Lady.jpg", "Starlight Stella.jpg", "Fiesta.jpg", "Three Cheers.jpg")

  • #2
    Super Moderator sage45's Avatar
    Join Date
    May 2002
    Posts
    1,064
    Thanks
    0
    Thanked 15 Times in 15 Posts
    This would be more of a javascript question... Moving you there...

    -sage-
    HTML & CSS Forum Moderator

    "If you don't know what you think you know, then what do you know."
    R.I.P. Derrick Thomas #58
    1/1/1967 - 2/8/2000

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    var strMainArrayValues = MainArray.join(" ").replace(/\|/g, "<br />");
    alert(strMainArrayValues);

    This will join all array elements separated by a space and will replace all |s by <br />s
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #4
    New Coder
    Join Date
    Jan 2003
    Location
    Italy
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi
    I'm sorry!! but I'm not an expert in javascript, I try the code, but it does'nt seem to work, perhaps I'm placing it in the wrong place, can you take a look at the script and if possible place it in the right spot.
    Thanks JD


    Code:
    <script language=javascript>
    <!--
    
    
    
    self.name = "main"; // names current window as "main"
    
    function clearLines() {
    document.all.copytext.innerHTML = "";
    }
    function ClipBoard() {
    holdtext.innerText = copytext.innerText;
    Copied = holdtext.createTextRange();
    Copied.execCommand("RemoveFormat");
    Copied.execCommand("Copy");
    alert ("The lines listed have been copied to the clipboard.\nYou can now paste them into your javascript photo album code!");
    }
    function makeLine() {
    currentText = document.all.copytext.innerHTML;
    newLine = 'MainArray[MainVar++] = new Fix("' + SuzyForm.PicName.value
      + '", "' + SuzyForm.PicTitle.value
      + '", "' + SuzyForm.PicCat.value
      + '", "' + SuzyForm.PicDesc.value
      + '", "' + SuzyForm.PodParent.value
      + '", "' + SuzyForm.PollenParent.value
      + '", "' + SuzyForm.PodMother.value
      + '", "' + SuzyForm.PodFather.value
      + '", "' + SuzyForm.PollenMother.value
      + '", "' + SuzyForm.PollenFather.value + '")';
    
    allLines = currentText + "<br>" + newLine;
    document.all.copytext.innerHTML = allLines;
    }
    
    // -->
    </script>
    Last edited by liorean; 06-08-2004 at 11:24 AM.

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Can you explain first what the page does? And if possible, post a link.
    I didn't understand why you have to create javascript codes inside a string and put it as innerHTML value.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #6
    New Coder
    Join Date
    Jan 2003
    Location
    Italy
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi

    This is what I’m trying to do, I have a form that creates javascript codes example:

    MainArray[MainVar++] = new Fix("", "", "A", "Form: Single| Flower Size: Mini /130mm| Texture:Medium| Duration:2-Days| Bloom Presentation:lateral", "", "", "", "", "", "")

    These codes will be used to build a database, the only problem with this data is that it will put the info in a text area in one continuous line example
    Form: Single| Flower Size: Mini /130mm| Texture:Medium|
    Duration:2-Days| Bloom Presentation:lateral

    I would like the output to look like the following:
    Form: Single
    Flower Size: Mini /130mm
    Texture:Medium
    Duration:2-Days
    Bloom Presentation:lateral

    That ‘s the reason why I want to replace “|” with a <br>
    Regards JD
    http://digilander.libero.it/JosephDi.../datamaker.htm

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    try:

    document.SuzyForm.PicDesc.value = MainArray[x].hybridizer.replace(/\|/g, "\n");

    where x is the index of an array element.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #8
    New Coder
    Join Date
    Jan 2003
    Location
    Italy
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm really sorry, I tried but it doensn't seem to work.
    perhaps I'm placing it in the wrong location of the script.

  • #9
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Can you post the link of the updated page?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #10
    New Coder
    Join Date
    Jan 2003
    Location
    Italy
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #11
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    I'm confused on what you really want. Which one of the two you want the display changed, the textarea named PicDesc or the div with id copytext?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #12
    New Coder
    Join Date
    Jan 2003
    Location
    Italy
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the textarea named PicDesc should have the change.

  • #13
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    When do you want it changed? When the [add this line] button is clicked? But you clear the fields when that button is clicked.
    Or maybe when the [send] button is clicked in the Hybridizer Name and Photo Credit fields?

    Anyway, wherever it is, the code should be:

    document.SuzyForm.PicDesc.value = document.SuzyForm.PicDesc.value.replace(/\|/g, "\n");
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #14
    New Coder
    Join Date
    Jan 2003
    Location
    Italy
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts
    We are getting close to a solution, I’ve used your code:
    document.SuzyForm.PicDesc.value = document.SuzyForm.PicDesc.value.replace(/\|/g, "\n"); but it doesn’t place a <br> between strings, so I changed the last part to (/\|/g, "<br>"); by doing this, the code generated by the script will no longer be a continuous line.

    Output example:
    "Form: Single,Windmill,Fringed<br> Flower Size: Mini /130mm<br> Texture:Medium<br> Duration:2-Days<br> Bloom Presentation:upward<br> Body Color: Brown<br> Eye Zone: Brown"

  • #15
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I do not think you need the quotes around the new line (\n) equivelent.

    document.SuzyForm.PicDesc.value = document.SuzyForm.PicDesc.value.replace(/\|/g, \n);


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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