Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Is a Selection Made:


Message #1 by "Robert Sindall" <rsindall@z...> on Thu, 14 Nov 2002 10:33:22 -0000
Hi

I'm making a pigs ear of this. (inserting an image into RichTextBox)

I need to check to see if a selection point has been made:
If it has insert, else set the focus and createRange and insert...


		function AddImage()
		{
		var rtb_id = document.<%=editor %>;
		var item = document.Form1.ImageUrl;
		if (item.value != "none")
			{
			rtb_id.focus();
				//need to check to see if a selection has been made
				if (sel == "")
				{
				var rtb_id = document.<%=editor %>;
				rtb_id.focus()
				sel = rtb_id.document.selection.createRange();
				}
			//sel = rtb_id.document.selection.createRange();
			sel.pasteHTML('<img border=0 src=' + item.value + ' />');
			item.value = "none";
			}		
			else
			{
			rtb_id.focus();
			sel = rtb_id.document.selection.createRange();
			GoToFileManager();
			}
		}


Thanks

Robert

  Return to Index