OnClick "ok" then next prompt for text input

Discussion in 'JavaScript' started by muppethunter, Aug 1, 2008.

  1. #1
    I am trying to figure out how to call a second prompt after clicking "Ok". I need the second promt to ask for a simple text and then when "ok" is clicked again it will fill the text area with the user's input. I'm not very good with js so I need alot of help. Anyone have any ideas?
     
    muppethunter, Aug 1, 2008 IP
  2. kalisthegreat

    kalisthegreat Peon

    Messages:
    132
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    When you click Ok before the second prompt is displayed, what is displayed? a prompt or just an alert box?
     
    kalisthegreat, Aug 1, 2008 IP
  3. muppethunter

    muppethunter Guest

    Messages:
    123
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The first prompt ask's for a URL and when ok is clicked the URL is input into the text area.(post editor) The second prompt needs to ask for plain text and when ok is clicked it needs to do the same. If it helps it is like vb post editor on digital point.

    Thank you so much for a quick response.
     
    muppethunter, Aug 1, 2008 IP
  4. kalisthegreat

    kalisthegreat Peon

    Messages:
    132
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    kalisthegreat, Aug 1, 2008 IP
  5. kalisthegreat

    kalisthegreat Peon

    Messages:
    132
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Is this what you wanted

    <script language="javascript">
    window.onload = function()
    {
    textarea = document.getElementById('text');
    url = prompt('enter url','');
    if(url.length > 1)
    {
    text4url = prompt('enter text','');
    textarea.value += '<a href='+url+'>'+text4url+'</a>';


    }

    }
    </script>

    <textarea id="text" cols="90" rows="30">
    </textarea>
     
    kalisthegreat, Aug 1, 2008 IP
  6. muppethunter

    muppethunter Guest

    Messages:
    123
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Let me give it a shot and see what happens. I might have to mod it a little.
     
    muppethunter, Aug 1, 2008 IP
  7. jpinheiro

    jpinheiro Peon

    Messages:
    1,211
    Likes Received:
    15
    Best Answers:
    1
    Trophy Points:
    0
    #7
    lol you made a hyper link generator
     
    jpinheiro, Aug 2, 2008 IP
  8. jpinheiro

    jpinheiro Peon

    Messages:
    1,211
    Likes Received:
    15
    Best Answers:
    1
    Trophy Points:
    0
    #8
    you forgot a piece in the codeing the hyper link wouldnt have worked with out the <a href="url">text</a>

    <script language="javascript">
    window.onload = function()
    {
    textarea = document.getElementById('hpgenerator');
    hpurl = prompt('Enter The URL without \n\ http://www.','');
    if(hpurl.length > 1)
    {
    hptext = prompt('Enter URL text','');
    textarea.value += '<a href="http://www.'+hpurl+'/">'+hptext+'</a>';


    }

    }
    </script>

    <textarea id="hpgenerator" cols="90" rows="30">
    </textarea>
     
    jpinheiro, Aug 2, 2008 IP
  9. jpinheiro

    jpinheiro Peon

    Messages:
    1,211
    Likes Received:
    15
    Best Answers:
    1
    Trophy Points:
    0
    #9
    Heres A New One

    You Can Create a Hyper Link Click Ctrl + R and Create another HyperLink ect.ect.

    With a Select all Generated Content Button

    ------------------------------------------
    
    <!-- This Script Was Created by Cynscriptz --!>
    <script language="javascript">
    window.onload = function()
    {
    textarea = document.getElementById('select1');
    hpurl = prompt('Enter The URL without \n\ http://www.','');
    if(hpurl.length > 1)
    {
    hptext = prompt('Enter URL text','');
    textarea.value += '<a href="http://www.'+hpurl+'/">'+hptext+'</a><br>';
    
    
    }
    
    }
    </script>
    
    <script language="Javascript">
    <!--
    
    function selectAll(theField) {
    var tempval=eval("document."+theField)
    tempval.focus()
    tempval.select()
    }
    //-->
    </script>
    <b> Hit "Ctrl + R" to add another Link</b><br>
    This Script is to Create Hyper Links Faster Than Hand Typing Them<br>
    <br>
    <form name="generated">
    <a href="javascript:selectAll('generated.select1')">Select All</a><br>
    <textarea  name="select1" id="select1" cols="42.5" rows="50" value="<font size="1"> Powered by <a 
    
    href="http://cynscriptz.com"><font size="1">Cynscriptz</font></a><br>
    </textarea>
    </form>
    <br><br>
    This was Generated by The Script<br><br>
    
     Powered by <a href="http://cynscriptz.com"><font size="1">Cynscriptz</font></a><br>
    <a href="http://www.google.com/">Google</a><br><a href="http://www.myspace.com/">Myspace</a><br><a 
    
    href="http://www.youtube.com/">Youtube</a><br>
    
    <!-- This Script Was Created by Cynscriptz --!>
    
    Code (markup):
     
    jpinheiro, Aug 2, 2008 IP
  10. jpinheiro

    jpinheiro Peon

    Messages:
    1,211
    Likes Received:
    15
    Best Answers:
    1
    Trophy Points:
    0
    #10
    Heres Another That Does Linked Images

    Type Full image url
    then type website url example google.com

     <!-- This Script Was Created by Cynscriptz --!>
    <script language="javascript">
    window.onload = function()
    {
    textarea = document.getElementById('select1');
    imgurl = prompt('Enter The Whole Image URL with \n\ http://www.','');
    if(imgurl.length > 1)
    {
    hpurl = prompt('Enter Website Image is Linked to without \n\ http://www.','');
    textarea.value += '<a href="http://www.'+hpurl+'"><img src="'+imgurl+'" border="0"></a><br>';
    
    
    }
    
    }
    </script>
    
    <script language="Javascript">
    <!--
    
    function selectAll(theField) {
    var tempval=eval("document."+theField)
    tempval.focus()
    tempval.select()
    }
    //-->
    </script>
    <b> Hit "Ctrl + R" to add another I-Hyper Link</b><br>
    This Script is to Create Image Hyper Links Faster Than Hand Typing Them<br>
    <br>
    <form name="generated">
    <a href="javascript:selectAll('generated.select1')">Select All</a><br>
    <textarea  name="select1" id="select1" cols="42.5" rows="50" value="<font size="1"> Powered by <a 
    
    href="http://cynscriptz.com"><font size="1">Cynscriptz</font></a><br>
    </textarea>
    </form>
    <br><br>
    This was Generated by The Script<br><br>
     Powered by <a href="http://cynscriptz.com"><font size="1">Cynscriptz</font></a><br>
    <a href="http://www.hotmail.com"><img src="http://gfx2.hotmail.com/mail/w3/pr01/ltr/i_yellowshield.gif" border="0"></a><br>
     
    
    <!-- This Script Was Created by Cynscriptz --!>
    Code (markup):
     
    jpinheiro, Aug 2, 2008 IP