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.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    41
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Program similar to this forum, but slightly broken

    I have created a program that works great but sometimes it does not finish. It is the exact same as the one we see in this forum when you want to insert an image into a forum post. The program takes in a users image url through prompt, then regenerates the information within the textbox with [img] tags. The problem is I try to do this once and it will work great, but then I will try it again and fill out all of the information the exact same way and nothing happens. By nothing happens I mean after I hit enter the text box will remain empty with no regenerated code. But if I do a page refresh it works. That leads me to believe there is nothing wrong with my code b/c I do it once and get a sound result, then again and get nothing. Anyone have any experience with broken programs like this before or any words of advice?

    PHP Code:
    <script language="javascript">
      function 
    imgGenerator(){
          var 
    question=confirm("Share a Picture?");
          if (
    question==true){
          var 
    obj=document.getElementById("mngl-board-post-input");
          var 
    imgurl prompt('To Share an image paste the image url here \nSupport .jpg .jpeg .gif .bmp and .png');
          if (
    imgurl == "" || imgurl == null) {return false;} 
          var 
    txt=document.createTextNode("[a][img]"+imgurl+"[/img][/a]");
          
    obj.appendChild(txt);
          }
          else {}
      }
      
    </script> 
    PHP Code:
    <a href="javascript:void(0);"  onClick="imgGenerator();"><img src="http://instride.org/images/image.png" alt="Share an Image"  /></a

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    3,020
    Thanks
    56
    Thanked 566 Times in 563 Posts
    hard to say. Seems to work OK in FF and IE8. What browser are you testing in?

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    41
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by xelawho View Post
    hard to say. Seems to work OK in FF and IE8. What browser are you testing in?
    Testing in firefox. For some reason I just get no output at times. I guess I'll just leave it. Very strange but thank your for testing it out for me


  •  

    Posting Permissions

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