...

View Full Version : printing Textarea problems



Alize
08-25-2006, 11:49 AM
Heya All,

Im a professional PHP Developer for a company called Villaway, but that is irrelevant, i posted that so you know I have programming knowledge and from what I can see, JavaScript is very similar to PHP and ActionScript, im a noob when it comes to JavaScript but not when it comes to PHP.

I am making my own Dreamweaver Extension (I know maybe i should seek help from an extension developing forum), all it does it insert some text (in the format of comment codes) into the top of any page you save, its actually a simple Version Control System.

I have made my menu etc, it contains a Textarea, i had it working once but deleted it! Here is what Ive got (by the way, i am using another extension and just editing it for now whilst im still learning hence the uppercase tags!):

File: trystVC.htm

<!DOCTYPE HTML SYSTEM "-//Macromedia//DWExtension layout-engine 5.0//dialog">

<HTML>
<HEAD>
<Title>Trystans Version Control</Title>
<SCRIPT SRC="trystVC.js"></SCRIPT>

</HEAD>
<BODY>
<form name="uorl">
<table border="0">
<tr>
<td valign="top" nowrap>
<textarea name="content" cols="80" rows="10"></textarea></td>
</tr>
</table>
</div>
</form>
</BODY>
</HTML>

File: trystVC.js


// JavaScript Document

function commandButtons() {
return new Array("OK", "changeCase()", "Cancel", "window.close()");
}

function changeCase() {
var uorl;
if(document.forms['uorl'].elements[0])
{
alert(document.forms['uorl'].elements[0]);
}
else
{
alert("NO");
}
window.close(); // close extension UI
}


Now my problem is for one I cannot return if the textarea is empty, and second i cant return what is actually entered into the textarea...

I understand the syntax of JavaScript as it is almost identical to PHP but i do not know many JavaScript functions! I wish there was a JavaScript manual like their is a PHP one on php.net!

All help is appreciated, im starting off simple and build it up! That way I will understand it better!

Thanks again.

name _F1
08-25-2006, 12:13 PM
There is a Javascript reference:

http://www.javascriptkit.com/jsref/
http://www.w3schools.com/js/default.asp

Alize
08-25-2006, 12:17 PM
Thanks a lot DownStrike,

after browsing the JavaScript forums on here, i was looking at other peoples codes and fixed it myself :) here is my revised code:



// JavaScript Document

function commandButtons() {
return new Array("OK", "changeCase()", "Cancel", "window.close()");
}

function changeCase() {
var uorl;
if(document.forms['uorl'].elements[0])
{
alert(document.forms['uorl'].content.value);
}
else
{
alert("NO");
}
window.close(); // close extension UI
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum