I have the following javascript code: else if(tag == 'img') { var path = prompt('Enter link', 'http://'); var classAlign = prompt('Chose alignment: left, right or center'); var altText = prompt('Description'); if(!path || !classAlign || !altText) { return; } if (document.selection) { field.focus(); var selected = document.selection.createRange().text; var ins = '[' + tag + '='+path + ' ' + classAlign + ' ' + altText + ']' + altText + '[/' + tag+']'; var selected2 = document.selection.createRange(); var sel = document.selection.createRange(); sel.text = '[' + tag + '='+path + ' ' + classAlign + ' ' + altText + ']' + altText + '[/' + tag+']'; selected2.moveStart ('character', -field.value.length); sel.moveStart('character', selected2.text.length + ins.length - selected.length); } Code (markup): What I would like to do is the following: I would like to make the "chose alignment" a radio-button-choice, instead of prompt where the user would have to write in the value. I would also like to add a possible choice between "enter url" or "chose file for upload", if possible Would it be possible to amend the script for my needs? This is of course not the whole script, just the part pertaining to the picture upload. Any help would be greatly appreciated.
I'm bumping this - anyone have any tips for how to make this work as I want (read first post)? Any help would be appreciated!
Well, it does, sort of. It's just that I want the radio-buttons for left/right/center to be available in the pop-up box (ie, I don't really want to do a window.open). The current solution is just using .prompt to open an input text-field, and the user can then write either left,right or center - what I want is for the user to just click on either left, right or center and the value will be passed to the rest of the javascript. Prompt won't do this of course, so what I'm looking for is another function that will let me put html-code in what is more or less an alert-box - but I don't know if this is possible using "plain" javascript.