Click to See Complete Forum and Search --> : Help with highlite and tag insert.
sciguyryan
12-12-2003, 03:37 PM
Hi all,
I am creating a code to create webpages and, want to know if anyone has a code that I can use to make it so that when the user highlites some text, clicks a specific formating button E.G. <B> and it wraps around the text and ends at the end of the selected text.
Ideas anyone?
fredmv
12-12-2003, 03:39 PM
http://www.mozilla.org/editor/midasdemo/
sciguyryan
12-12-2003, 03:43 PM
could you help me insert it into this code?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>Untitled</TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
<!--
function StartIt(){
var tester = document.getElementById("inserter")
var insStart = "<HTML><HEAD>"
tester.value = insStart
}
function Title()
{
var tester = document.getElementById("inserter")
var title = window.prompt("Please enter a title for your page", "Page title here");
tester.value += "<TITLE>"+title+"</TITLE></HEAD>"
}
function Body()
{
var ALINK = confirm("Do you want to add an Active link colour?");
if (ALINK = true){
ALINK = prompt("Please enter a colour for your Active link[s]", "Black")
ALINK = ALINK.toUpperCase()
}
var SLINK = confirm("Do you want to add an link colour?");
if (SLINK = true){
SLINK = prompt("Please enter a colour for your link[s]", "Blue")
SLINK = SLINK.toUpperCase()
}
var VLINK = confirm("Do you want to add an Visited link colour?");
if (VLINK = true){
VLINK = prompt("Please enter a colour for your Visited link[s]", "Green")
VLINK = VLINK.toUpperCase()
}
var BgColour = confirm("Do you want to add a document background colour colour?");
if (BgColour = true){
BgColour = prompt("Please enter a colour for your Visited link[s]", "Green")
BgColour = BgColour.toUpperCase()
}
var tester = document.getElementById("inserter")
tester.value += "<BODY ALINK='"+ALINK+"' LINK='"+SLINK+"' VLINK='"+VLINK+"' BGCOLOR='"+BgColour+"'>"
}
function End(){
var tester = document.getElementById("inserter")
tester.value += "</BODY></HTML>"
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<TEXTAREA ID="inserter" COLS="40" ROWS="8" WRAP="virtual"></TEXTAREA>
<INPUT TYPE="button" VALUE="Click me to start" OnClick="StartIt();" />
<INPUT TYPE="button" VALUE="Title" OnClick="Title();" />
<INPUT TYPE="button" VALUE="Body" OnClick="Body();" />
<INPUT TYPE="button" VALUE="End" OnClick="End();" />
</FORM>
<BR>
</BODY>
</HTML>
sciguyryan
12-13-2003, 01:55 AM
Can anyone help?