View Full Version : Program similar to this forum, but slightly broken

01-08-2012, 06:33 PM
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 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?

<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("[img]"+imgurl+"");
else {}

<a href="javascript:void(0);" onClick="imgGenerator();"><img src="http://instride.org/images/image.png" alt="Share an Image" /></a>

01-09-2012, 05:08 AM
hard to say. Seems to work OK in FF and IE8. What browser are you testing in?

01-10-2012, 02:02 PM
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