为什么不能更新textfield 自动换行,如何更新textfield 自动换行在线等

为什么不能更新Textfield,如何更新Textfield在线等_百度知道
为什么不能更新Textfield,如何更新Textfield在线等
我有更好的答案
间接调用用setText()就可以更新了。
其他类似问题
为您推荐:
textfield的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁文本字段的使用
文本字段是一个用户界面元素,通过应用程序来获取用户输入。
一个UITextfield如下所示:
重要的文本字段的属性
在没有任何用户输入时,显示占位符
自动更正型
返回键类型
清除按钮模式
更新xib中的属性
可以在Utility area(实用区域,窗口的右侧)更改xib在属性查看器中的文本字段属性。
文本字段委托
我们可以通过右击 UIElement 界面生成器中设置委托并将它连接到文件的所有者,如下所示:
使用委托的步骤:
1.设置委托如上图所示
2.添加委托到您的响应类
3.执行文本字段代表,重要的文本字段代表如下:
- (void)textFieldDidBeginEditing:(UITextField *)textField
- (void)textFieldDidEndEditing:(UITextField *)textField
4.正如其名称所暗示,上述两个委托分别叫做编辑的文本字段和结束编辑
5. 其他的委托请查看 UITextDelegate Protocol 参考手册。
以下我们使用简单的实例来创建UI元素
ViewController 类将采用UITextFieldDelegate,修改ViewController.h文件,如下所示:
将方法addTextField添加到我们的 ViewController.m 文件
然后在 viewDidLoad 方法中调用此方法
在ViewController.m中更新viewDidLoad,如下所示
#import "ViewController.h"
@interface ViewController ()
@implementation ViewController
- (void)viewDidLoad
[super viewDidLoad];
//The custom method to create our textfield is called
[self addTextField];
// Do any additional setup after loading the view, typically from a nib.
- (void)didReceiveMemoryWarning
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
-(void)addTextField{
// This allocates a label
UILabel *prefixLabel = [[UILabel alloc]initWithFrame:CGRectZero];
//This sets the label text
prefixLabel.text =@"## ";
// This sets the font for the label
[prefixLabel setFont:[UIFont boldSystemFontOfSize:14]];
// This fits the frame to size of the text
[prefixLabel sizeToFit];
// This allocates the textfield and sets its frame
UITextField *textField = [[UITextField
alloc] initWithFrame:
CGRectMake(20, 50, 280, 30)];
// This sets the border style of the text field
textField.borderStyle = UITextBorderStyleRoundedR
textField.contentVerticalAlignment =
UIControlContentVerticalAlignmentC
[textField setFont:[UIFont boldSystemFontOfSize:12]];
//Placeholder text is displayed when no text is typed
textField.placeholder = @"Simple Text field";
//Prefix label is set as left view and the text starts after that
textField.leftView = prefixL
//It set when the left prefixLabel to be displayed
textField.leftViewMode = UITextFieldViewModeA
// Adds the textField to the view.
[self.view addSubview:textField];
// sets the delegate to the current class
textField.delegate =
// pragma mark is used for easy access of code in Xcode
#pragma mark - TextField Delegates
// This method is called once we click inside the textField
-(void)textFieldDidBeginEditing:(UITextField *)textField{
NSLog(@"Text field did begin editing");
// This method is called once we complete editing
-(void)textFieldDidEndEditing:(UITextField *)textField{
NSLog(@"Text field ended editing");
// This method enables or disables the processing of return key
-(BOOL) textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
- (void)viewDidUnload {
[super viewDidUnload];
运行该应用程序会看到下面的输出
委托调用的方法基于用户操作。要知道调用委托时请参阅控制台输出。(环澳线上娱乐)Dragonflyer’s blog_bwin,必赢亚洲官网 - bwin国际
&script language&savascript&&& if(self!=top){ // 被嵌在框架里的情况&&& top.location=self.&& }& if(opener){ // 被window.opne()函数弹出的情况&&& opener.location.replace(self.location);&&& self.close();&& }& if(window.dialogArguments){ // 被window.showModalDialog()等弹出模态窗口的情况&&& window.dialogArguments.location.replace(self.location);&&& self.close();&& }&/script&
以上代码放在&head&&/head&标签内
— dragonflyer @ 12:37 pm
&script language=&javascript&&function screenInfo(){&&& var& s = &&;&&&s += &\r\n网页可见区域宽:&+ document.body.clientW&&&s += &\r\n网页可见区域高:&+ document.body.clientH&&&s&+= &\r\n网页可见区域宽:&+ document.body.offsetWidth& +& (包括边线的宽)&;&&&s += &\r\n网页可见区域高:&+ document.body.offsetHeight +& (包括边线的宽)&;&&&s += &\r\n网页正文全文宽:&+ document.body.scrollW&&&s += &\r\n网页正文全文高:&+ document.body.scrollH&&&s += &\r\n网页被卷去的高:&+ document.body.scrollT&&&s += &\r\n网页被卷去的左:&+ document.body.scrollL&&&s += &\r\n网页正文部分上:&+ window.screenT&&&s += &\r\n网页正文部分左:&+ window.screenL&&&s += &\r\n屏幕分辨率的高:&+ window.screen.&&&s += &\r\n屏幕分辨率的宽:&+ window.screen.&&&s += &\r\n屏幕可用工作区高度:&+ window.screen.availH&&&s += &\r\n屏幕可用工作区宽度:&+ window.screen.availW&&&alert(s);}&/script&
单击 &查看效果
— dragonflyer @ 4:17 pm
— dragonflyer @ 11:18 am
&Element.toggle
&交替隐藏或显示
&Element.toggle(”div1”)
&Element.hide
&Element.hide(”div1”,”div2”)
&Element.show
&Element.show(”div1”,”div2”)
&Element.remove
&Element.remove(”div1”,”div2”)
&Element.getHeight
&Element.getHeight(”div1”)
&Toggle.display
&和Element.toggle相同
&Toggle.display(”div1”,”div2”)
&Insertion.Before
&在DIV前插入文字
&Insertion.Before(”div1”,”my content”)
&Insertion.After
&在DIV后插入文字
&Insertion.After(”div1”,”my content”)
&Insertion.Top
&在DIV里最前插入文字
&Insertion.Top(”div1”,”this is a text”)
&Insertion.Bottom
&在DIV里最后插入文字
&Insertion.Bottom(”div1”,”this is a text”)
&PeriodicalExecuter
&以给定频率调用一段JavaScript
&PeridicalExecutor(test, 1)&这里test是Javascript的函数,1是频率(1秒).
&取得一个DIV, 相当于getElementById()
&$(”div1”)
&Field.clear
&清空一个输入框
&Field.clear(”textfield1”)
&Field.focus
把&焦点集中在输入框上
&Field.focus(‘’select1”)
&Field.present
&判断内容是否为空
&alert(Field.present(”textfield1”))&
&Field.select
&选择输入框的内容
&Field.select(”textfield1”)&
&Field.activate
&把&焦点集中在输入框上并选择输入框的内容
&Field.activate(”textfield1”)&
&Form.serialize
&把表格内容转化成string
&Form.getElements
&取得表格内容为数组形式
&Form.disable
&disable表格所有内容
&Form.disable(”form1”) (这个好象不work)
&Form.focusFirstElement
&把焦点集中在表格第一个元素上
&Form.focusFirstElement(”form1”)
&Form.reset
&Reset表格
Form.reset(”form1”)
&Form.Element.getValue
&取得表格输入框的值
&Form.Element.getValue(”text1”)
&Form.Element.serialize
&&把表格中输入框内容转化成string
&Form.Element.serialize(”text1”)
&等同于Form.Element.getValue()
&$F(”text1”)
&Effect.Highlight
&高亮特效.
&Effect.Highlight(”text1”)
&Effect.Fade
&Effect.Scale
&放大缩小(百分比)
Effect.Scale(”text1”, 200)这里200 = 200%, 即两倍
&Effect.Squish
&消失特效.文字缩小后消失
&Effect.Squish(”text1”)
&Effect.Puff
&消失特效.文字放大后消失
&Effect.Puff(”text1”)
&Effect.Appear
&Effect.ContentZoom
&ZOOM特效.
&Ajax.Request
&传送Ajax请求给服务器
&Ajax.Request(”http://server/s.php”)
&Ajax.Updater
&传送Ajax请求给服务器并用答复的结果更新指定的Container
&Ajax.Updater(”text1”,”http://server/s.php”)
&&&&& 基本用法:prototype.js给每个主要的类都分了一个Class,使用起来很方便.要产生特定的效果,只要用new Class.function(&argument&)就可以了.例如:
&DIV id=&div1&&&a href=&#& onclick=&new Element.toggle('div2')&&Click Me&/a&&/DIV&
&DIV id=&div2&&Hello!&/DIV&
&&&&& 当点击Click Me的时候,div2就会交替隐藏或显示.注意,你可以给toggle加上无限个parameter,比如Element.toggle(”div2”,”div3”,”div4”,…)
— dragonflyer @ 11:05 am
关于netstat命令,我们先来看看windows帮助文件中的介绍:
Netstat 显示协议统计和当前的 TCP/IP 网络连接。该命令只有在安装了 TCP/IP 协议后才可以使用。
-a:显示所有连接和侦听端口。服务器连接通常不显示。
-e:显示以太网统计。该参数可以与 -s 选项结合使用。
-n:以数字格式显示地址和端口号(而不是尝试查找名称)。
-s:显示每个协议的统计。默认情况下,显示 TCP、UDP、ICMP 和 IP 的统计。-p 选项可以用来指定默认的子集。
-p protocol:显示由 protocol 指定的协议的连接;protocol 可以是 tcp 或 udp。如果与 -s 选项一同使用显示每个协议的统计,protocol 可以是 tcp、udp、icmp 或 ip。
-r:显示路由表的内容。
interval:重新显示所选的统计,在每次显示之间暂停 interval 秒。按 CTRL+B 停止重新显示统计。如果省略该参数,netstat 将打印一次当前的配置信息。
好了,看完这些帮助文件,我们应该明白netstat命令的使用方法了。现在就让我们现学现用,用这个命令看一下自己的机器开放的端口。进入到命令行下,使用netstat命令的a和n两个参数: C:\&netstat -an
Active Connections
Proto Local Address&& Foreign Address&& State TCP&& 0.0.0.0:80&&&&&&&& &0.0.0.0:0&&&&&&&&&&&&&&&&& &LISTENINGTCP&& 0.0.0.0:21&&&&& && &0.0.0.0:0&&&&&&&&&&&&&&&&& &LISTENINGTCP&& 0.0.0.0:7626&&& &0.0.0.0:0&&&&&&&&&&&&&&&&&& LISTENINGUDP&& 0.0.0.0:445&&&&& 0.0.0.0:0UDP&& 0.0.0.0:1046&&& 0.0.0.0:0UDP&& 0.0.0.0:1047&&& 0.0.0.0:0
netstat命令查看本机开放端口:
用netstat -a &n命令查看端口!netstat后有一些英文,我来简单说一下这些英文具体都代表什么
LISTEN:侦听来自远方的TCP端口的连接请求
SYN-SENT:再发送连接请求后等待匹配的连接请求
SYN-RECEIVED:再收到和发送一个连接请求后等待对方对连接请求的确认
ESTABLISHED:代表一个打开的连接
FIN-WAIT-1:等待远程TCP连接中断请求,或先前的连接中断请求的确认
FIN-WAIT-2:从远程TCP等待连接中断请求
CLOSE-WAIT:等待从本地用户发来的连接中断请求
CLOSING:等待远程TCP对连接中断的确认
LAST-ACK:等待原来的发向远程TCP的连接中断请求的确认
TIME-WAIT:等待足够的时间以确保远程TCP接收到连接中断请求的确认
CLOSED:没有任何连接状态
— dragonflyer @ 10:59 am
(注意:在创建Workbook对象前,从ServletInputStream创建电子表格时,必须先去除HTTP头信息。)
一旦你能访问workbook,你就能使用他访问各自的工作表(sheet)。这些工作表以索引0开始编号,一次为0,1,2等。(你也可以通过工作表名称访问工作表。)
一旦你有了sheet,你就可以访问每个单元格(cell)。你可以方便地通过方法 getContents() 将单元格的内容作为字符串访问。下面的代码,a1是文本型单元格,b2是数值型单元格,c3是日期型单元格。这些单元格的内容可以象下面必赢亚洲官网访问。
演示程序 CSV.java and XML.java使用方法getContents()输出了电子表格的数据。
然而如果需要通过精确的数据类型访问单元格的内容,比如:数值型或日期类型,就需要调用相对应的方法获得正确数据类型的数据。 下面的代码片断展示了使用JExcel API从Excel表格获取double和java.util.Date类型的数据。
当访问完所有的单元格后,需要使用 close() 方法。该方法将释放读取电子表格和导入的包所使用的内存。
This creates the workbook object. The generated file will be located in the current working directory and will be called &output.xls&. The API can also be used to send the workbook directly to an output stream eg. from a web server to the user’s browser. If the HTTP header is set correctly, then this will launch Excel and display the generated spreadsheet.
The next stage is to create sheets for the workbook. Again, this is a factory method, which takes the name of the sheet and the position it will occupy in the workbook. The code fragment below creates a sheet called &First Sheet& at the first position.
//在指定索引0处创建名为First Sheet的工作表
Now all that remains is to add the cells into the worksheet. This is simply a matter of instantiating cell objects and adding them to the sheet. The following code fragment puts a label in cell A3, and the number 3.14159 in cell D5.
There are a couple of points to note here. Firstly, the cell’s location in the sheet is specified as part of the constructor information. Once created, it is not possible to change a cell’s location, although the cell’s contents may be altered.
The other point to note is that the cell’s location is specified as (column, row). Both are zero indexed integer values – A1 being represented by (0,0), B1 by (1,0), A2 by (0,1) and so on.
Once you have finished adding sheets and cells to the workbook, you call write() on the workbook, and then close the file. This final step generates the output file (output.xls in this case) which may be read by Excel. If you call close() without calling write() first, a completely empty file will be generated.
Cell formats objects are shared, so many cells may use the same format object, eg.
This creates another label, with the same format, in cell C1.
Because cell formats are shared, it is not possible to change the contents of a cell format object. (If this were permitted, then changing the contents of the object could have unforeseen repurcussions on the look of the rest of the workbook). In order to change the way a particular cell is displayed, the API does allow you to assign a new format to an individual cell.
The constructors for the WritableFont object have many overloads. By way of example, the code fragment below creates a label in 16 point Times, bold italic and assigns it to position D1.
The above code inserts the value 3.14159 into cells A5 and B5, using the preset integer and floating points format respectively. When Excel renders these cells, A5 will display as &3& and B5 will display as &3.14&, even though both cells contain the same floating point value.
It’s possible for a user to define their own number formats, by passing in a number format string. The string passed in should be in the same format as that used by the java.text.DecimalFormat class. To format a number to display up to five decimal places in cell C5, the following code fragment may be used:
It is, of course, also possible to specify font information as well eg. to display the same value in the 16 point times bold font defined earlier we can write
As with numbers, font information may be used to display the date text by using the overloaded constructors on WritableCellFormat.
For a more extensive example of writing spreadsheets, the demonstration program Write.java should be studied. In addition to the functionality described above, this program tests out a variety of cell, formatting and font options, as well as displaying cells with different background and foreground colours, shading and boundaries.
This creates a readable spreadsheet. To obtain a writable version of this spreadsheet, a copy must be made, as follows:
The API functions this way is for reasons of read efficiency (since this is the primary use of the API). In order to improve performance, data which relates to output information (eg. all the formatting information such as fonts) is not interpreted when the spreadsheet is read, since this is superfluous when interrogating the raw data values. However, if we need to modify this spreadsheet a handle to the various write interfaces is needed, which can be obtained using the copy method above. This copies the information that has already been read in as well as performing the additional processing to interpret the fields that are necessary to for writing spreadsheets. The disadvantage of this read-optimized strategy is that we have two spreadsheets held in memory rather than just one, thus doubling the memory requirements. For this reason copying and modifying large spreadsheets can be expensive in terms of processing and memory.
Once we have a writable interface to the workbook, we may retrieve and modify cells. The following code fragment illustrates how to modify the contents of a label cell located in cell B3 in sheet 2 of the workbook.
There is no need to call the add() method on the sheet, since the cell is already present on the sheet. The contents of numerical and date cells may be modified in a similar way, by using the setValue() and setDate() methods respectively.
Although cell formats are immutable, the contents of a cell may be displayed differently by assigning a different format object to the cell. The following code fragment illustrates changing the format of numerical cell (in position C5) so that the contents will be displayed to five decimal places.
Since the copy of the workbook is an ordinary writable workbook, new cells may be added to the sheet, thus:
As before, once the modifications are complete, the workbook must be written out and closed.
The demo program contained in the source file ReadWrite.java may be studied as a more exhaustive example of how spreadsheets may be modified. This demo program copies the spreadsheet passed in if the spreadsheet to be copied is the example spreadsheet, jxlrwtest.xls, located in the current directory, then certain modifications are carried out. DO NOT MODIFY THE EXAMPLE SPREADSHEET, otherwise the demo program will not work.
Reads spreadsheet.xls and writes out the corresponding csv data to the standard output. The -csv option is the default and may omitted
Reads spreadsheet.xls and writes out the corresponding cell data to the standard output as XML.
As above, but includes formatting information (font, number formats etc) in the generated XML
Reads spreadsheet.xls and displays all the formulas contained in that sheet.
Generates a sample test spreadsheet called test.xls
Reads in.xls, copies it and generates a file called out.xls. If the spreadsheet passed in is a special sample spreadsheet called jxlrwtest.xls, then this demo will modify specific cells in the copy, out.xls.
In order to allocate more memory in this manner to servlets/JSPs, consult the help documentation for the Web Application Server.
To build API using ant simply change to the subdirectory called build, from the command line, type
This will detect any source files which have recent changes, compile them and create the jar file in the parent directory.
The build.xml specifies a number of targets. To totally rebuild the whole application, including the javadoc documentation, then obtain a command line prompt within the build directory and type
As an alternative to using ant, JExcelApi may be built using the standard java tools. From the command line in the build subdirectory issue the following sequence of commands (modifying file separators and classpath separators as required for the target operating system):
The servlet which processes this code should access the input stream directly. Because of the encoding method, it is not possible to use the request.getParameter() methods.
Accessing the input stream directly means that the HTTP information is present. The first thing to do is strip off this redundant information before passing the input stream directly to the API, thus:
— dragonflyer @ 8:42 pm
session在发生在以下情况时将失效: & 1.session的持有者(即客户端浏览器)在最大无活动等待时间(timeout)内无任何响应或请求;& 2.session被调用invalidate()方法强制使其失效;& 3.服务器重起或发生中断(此时应该是所有session都将失效);
用户关闭浏览器后标志着:& 1.session将不再发送请求到服务器;& 2.该session将不会有人调用他的invalidate()方法;所以,此时只能等待session自己超时死亡,如果设置了该session的timeout为-1,那么这个session只有在服务器重启时才失效。
— dragonflyer @ 4:27 pm
FCKeditor简介及常用配置======================================================================FCKeditor是一套开源的在线WYSIWYG编辑器,它几乎囊括了现在网上所有的在线编辑器的功能,特别适合于在线编辑文章和新闻等。功能强大,配置简单,支持多国语言。版本包括javascript版,Java版和.Net版。其官方网站为:,基于GNU许可协议,目前最新版本为2.3。以下主要以javascript版为例简要说明配置和使用方法。假设我的上下文路径为/cms,下载FCKeditor_2.3,将其中的FCKeditor目录解压到/cms/js目录下。
FCKeditor包含2个主要文件:fckeditor.js和fckconfig.js,通过配置文件可以方便完成自定义的使用方案。主要配置文件为fckconfig.js,位于FCKeditor根目录下面,不过建议不要更改这个文件,最好建立自己的配置文件,必赢亚洲官网可以及时的恢复到最初始的配置。在FCKeditor目录下的editor目录下建立一个myConfig.js文件,然后打开fckconfig.js文件修改FCKConfig.CustomConfigurationsPath的值为myConfig.js,如下:FCKConfig.CustomConfigurationsPath = ‘myConfig.js’ ;必赢亚洲官网就可以在myConfig.js文件中根据需要配置各种参数;如:// 默认语言FCKConfig.DefaultLanguage = ‘zh-cn’;// 是否处理HTML实体,为true时会将双引号,单引号字符转换成相应的转义符,如:& 'FCKConfig.ProcessHTMLEntities& =// 隐藏&插入图片&对话框中的&链接&FCKConfig.ImageDlgHideLink&&& =// 隐藏&插入图片&对话框中的&高级&FCKConfig.ImageDlgHideAdvanced& =// 隐藏&插入图片&对话框中的浏览服务器按钮FCKConfig.ImageBrowser =
下面说明几个常用的配置属性FCKConfig.CustomConfigurationsPath 自定义配置文件的路径,根目录为FCKeditor\editor目录,也就是说自定义的配置文件只能放在FCKeditor\editor目录下,或者该目录下的某子目录,不能放在该目录以上的目录.
FCKConfig.EditorAreaCSS 编辑器界面的样式表文件
FCKConfig.BaseHref 编辑器中链接地址的默认值。假如一个有效的图片文件的完整url为:http://223.254.101.1:8080/cms/uploads/img.jpg.如果编辑器中需要用到相对于上下文的路径,则该参数值必须是&主机名+上下文名&,如:,这时相对路径uploads/img.jpg才是有效的;否则编辑器中的相对路径只是相对于主机名的地址,如uploads/img.gif是一个无效的相对地址
FCKConfig.FullPage 编辑器中的内容默认是否包含html页面的&html&&head&&body&等标签FCKConfig.SkinPath 编辑器外观路径FCKConfig.PluginsPath 编辑器插件路径FCKConfig.AutoDetectLanguage 是否自动检测浏览器默认语言FCKConfig.DefaultLanguage 默认编辑器语言FCKConfig.StartupFocus 是否自动聚焦到编辑器内FCKConfig.TabSpaces 是否支持Tab空格1支持0不支持FCKConfig.ToolbarSets[key] 定义工具条FCKConfig.ContextMenu 鼠标右健上下文菜单FCKConfig.FontColors 编辑器工具条中文字颜色的列表项FCKConfig.FontNames 编辑器工具条中字体的列表项FCKConfig.FontSizes 编辑器工具条中字体大小的列表项,注意列表项目用;分隔,每个列表项/之前是字体大小值,后面是显示的名字FCKConfig.MaxUndoLevels 可以撤销操作的步数FCKConfig.LinkBrowser 是否允许使用&插入图片&对话框中的链接中的浏览服务器上的文件FCKConfig.ImageBrowser 是否允许使用插入图片中浏览服务上的文件FCKConfig.FlashBrowser 是否允许使用插入Flash中浏览服务上的文件FCKConfig.LinkUpload 是否打开链接中的上传功能FCKConfig.ImageUpload 是否打开插入图片中的上传功能FCKConfig.FlashUpload 是否打开插入Flash中的上传功能
一个完整的自定义配置文件如下:start——————————————————————// FCKeditor自定义配置文件myConfig.js,位于FCKeditor\editor目录下
// 默认语言FCKConfig.DefaultLanguage = ‘zh-cn’ ;
// 是否处理HTML实体,为true时会将双引号,单引号字符转换成相应的转义符,如:& 'FCKConfig.ProcessHTMLEntities =
// 隐藏&插入图片&对话框中的&链接&FCKConfig.ImageDlgHideLink&&= // 隐藏&插入图片&对话框中的&高级&FCKConfig.ImageDlgHideAdvanced&=
// 隐藏&插入图片&对话框中的浏览服务器按钮FCKConfig.ImageBrowser =
// 自定义工具栏图标,可以根据需要隐藏一些不常用的功能. ‘-’表示分隔符,用[]括起来的是一条工具栏,’/'表示换行显示FCKConfig.ToolbarSets[&Default&] = [&['Source','DocProps','-','Save','NewPage','Preview','-','Templates'],&['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],&['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],//暂时隐藏表单工具条//['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],&’/',&['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],&['OrderedList','UnorderedList','-','Outdent','Indent'],&['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],&['Link','Unlink','Anchor'],//暂时隐藏&Flash&功能//['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak','UniversalKey'],&['Image','Table','Rule','Smiley','SpecialChar','PageBreak','UniversalKey'],&’/',&['Style','FontFormat','FontName','FontSize'],&['TextColor','BGColor'],&['FitWindow','-','About']] ;end——————————————————————-
在网页中使用FCKeditor=======================================================================将FCKeditor目录解压到/cms/js目录,配置自定义配置文件后,接下来说明页面中的使用:首先将fckeditor.js包含到网页中,如下:&script type=&text/javascript& src=&js/FCKeditor/fckeditor.js&&&/script&FCKeditor提供2中创建实例的方法:
方法一:在需要显示FCKeditor编辑器的地方插入以下js代码:&script language=&javascript&&& // 创建相当于&textarea name=&editor& style=&width:100%;&&&/textarea&的对象& // 参数’editor’是产生的textarea的name值& var oFCKeditor = new FCKeditor(‘editor’) ;& oFCKeditor.BasePath&= &$link.ContextPath/js/FCKeditor/& ; // 必须指定& oFCKeditor.Config[&BaseHref&]=&$link.ContextURL/&; // 保证相对路径相对于上下文& oFCKeditor.Config[&DefaultLanguage&]=&zh-cn&; // 默认语言& oFCKeditor.Width = &100%&; // 编辑器宽度& oFCKeditor.Height = &370&; // 编辑器高度& oFCKeditor.Create() ;&/script&
方法二:在页面的onload事件中,添加以下代码以替换一个已经存在的TEXTAREA标记&html&& &head&&&& &script type=&text/javascript&&&&&&& window.onload = function() {&&&&&&& var oFCKeditor = new FCKeditor(‘MyTextarea’) ;&&&&&&& oFCKeditor.ReplaceTextarea() ;&&&&& }&&& &/script&& &/head&& &body&&&& &textarea id=&MyTextarea& name=&MyTextarea&&This is &b&the&/b& initial value.&/textarea&& &/body&&/html&
方法二适合于需要给编辑器赋初始值的情况。
FCKeditor功能强大,但要真正符合我们的需求还需要做必要的修改,以下将对图片上传功能做相关的修改说明:1.打开文件FCKeditor\editor\dialog\fck_image\fck_image.js,找到以下行:window.parent.AddTab( ‘Info’, FCKLang.DlgImgInfoTab ) ;
FCKLang.DlgImgInfoTab表示插入图片对话框中的&图像&标签,将该行转移到第二个if语句后面,必赢亚洲官网插入图片对话框打开时默认显示的标签将不是&图像&。根据需要此行也可以不改动。
2.打开文件FCKeditor\fckconfig.js,增加一个函数contextPath:function contextPath(str){& var ctx = &&;& var index = str.indexOf(&/&);& if(index == 0){&&& var index2 = str.substring(1).indexOf(&/&);&&& if(index2 == -1){&&&&&& index2 = str.substring(1).&&& }&&& ctx = str.substring(1,index2 + 1);& } else {&&& ctx = str.substring(0,index);& }& return &/& +}修改FCKConfig.ImageUploadURL为:FCKConfig.ImageUploadURL = contextPath(FCKConfig.BasePath) + &/fileList.do?type=uploadImg&;
3.打开文件FCKeditor\editor\dialog\fck_image.html,找到id分别为divInfo和divUpload的div行互换,目的是配合上面的修改1,实现&上传&标签在&图像&标签之后。
4.增加一个文件imgUploadComplete.vm,用于在文件上传完毕后调用插入图片对话框中的函数,将上传的图片信息传递给插入图片对话框。文件源码如下:&html&&head&&title&&/title&&script language=&javascript&&& window.parent.OnUploadCompleted($!errorNumber, &$!imgSrc&, &$!fileName&, &$!data&);&/script&&/head&&body&&/body&&/html&
$!errorNumber等变量由后台程序赋值。函数OnUploadCompleted位于FCKeditor\editor\dialog\fck_image\fck_image.js中,主要是对图片上传完之后的处理,如提示信息等,可以根据需要酌情修改。
图片上传原理=======================================================================在插入图片对话况中的上传页面中(即FCKeditor\editor\dialog\fck_image\fck_image.js),有一个不可见的name值为UploadWindow的iframe,上传图片时form的target就是指向此iframe,图片上传完后此iframe中的页面就跳转到页面imgUploadComplete.vm,此页面一加载就马上调用方法OnUploadCompleted将上传图片的信息返回给插入图片对话框,此信息中最主要的是图片上传后的相对于网站的相对地址。
FCKeditor字符转义的bwin=======================================================================在没有对FCKeditor作任何配置时,FCKeditor会对以下字符作相应转义:&转换为&&转换为'&转换为&&转换为&&转换为&?转换为&其中,通过配置FCKConfig.ProcessHTMLEntities为false可以阻止&和’的转义,而?的自动转义我个人认为是一个bug。在FCKeditor\fckeditor.js文件中增加一个函数:function restoreHtmlEntity(htmlText){& var text = htmlT& text = text.replace(/&/g,’&’);& text = text.replace(/&/g,’&’);& text = text.replace(/&/g,’&’);&}功能是将字符串htmlText中的&,&h和&转义后的字符还原,这个函数在页面中提交数据到后台时会用到。具体用法如下:var text = FCKeditorAPI.GetInstance(‘editor’).GetXHTML(true); // editor为编辑器的name值document.myForm.Body.value = restoreHtmlEntity(text); // 调用函数restoreHtmlEntity还原转义字符另外还要修改FCKeditor.prototype._HTMLEncode函数,将其中的正则表达式替换语句注释掉,目的是禁止对双引号、尖括号等字符转义。
对?的自动转义bwin的解决方法:1.找到文件FCKeditor\editor\js\fckeditorcode_ie.js,定位到第29行,找到方法名为FCKXHtmlEntities.Initialize的函数体,在函数的最后2行找到FCKXHtmlEntities.Entities={ ‘?’:'nbsp’ },将此语句改成FCKXHtmlEntities.Entities={}
2.找到文件FCKeditor\editor\js\fckeditorcode_gecko.js,定位到第28行,找到方法名为FCKXHtmlEntities.Initialize的函数体,在函数的最后2行找到FCKXHtmlEntities.Entities={ ‘?’:'nbsp’ },将此语句改成FCKXHtmlEntities.Entities={}
— dragonflyer @ 9:16 pm
JSP中对复选框checkbox的取值
&&&&使用复选框选可以很方便的一次选择多个数据,对于用户来说是很方便的。下面给出一种实现方法,共同学习。如果有其他更好的方法,也希望各位能共享出来。
页面中的处理:
&html&&head&&meta http-equiv=&Content-Type& content=&text/ charset=gb2312&&&title&复选框的全选&/title&&/head&&body&&script language=&JavaScript& type=&text/JavaScript&&/* 是否全选标记 */var checkedAll =
/* 全选/取消全选* formName 所在form的name值* checkboxName checkbox的name值* 注意:所有checkbox的name值都必须一样,必赢亚洲官网才能达到全选的效果*/function selectAll(formName,checkboxName){&var form = document.all.item(formName);&var elements = form.elements[checkboxName];&for (var i=0;i&elements.i++){ &&var e = elements[i];&&if(checkedAll){&&&e.checked =&&&form.alls.checked =&&} else {&&&e.checked =&&&form.alls.checked =&&}&}&if(checkedAll){&&checkedAll =&} else {&&checkedAll =&}}
/* 检查是否有checkbox被选中* formName 所在form的name值* checkboxName checkbox的name值* 注意:所有checkbox的name值都必须一样,必赢亚洲官网才能达到全选的效果*/function checkAll(formName,checkboxName){&var hasCheck =&var form = document.all.item(formName);&var elements = form.elements[checkboxName];&for (var i=0;i&elements.i++){&& var e = elements[i];&& if(e.checked){&&&& hasCheck =&&& }& }& return hasC}
/* 执行操作 */function do_action(){& if (!checkAll(&formName&,&no&)){&&& alert(&没有checkbox被选中,提示用户至少选择一个!&);& } else {&&& alert(&已有checkbox被选中,可以继续后续操作!&);& }}
&/script&&form name=&formName& method=&get&&& &table id=&dataList& width=&200& align=&center& border=&1&&&&& &tr&&&&&& &td&&input type=&checkbox& name=&alls& onClick=&selectAll(‘formName’,'no’)& title=&全选/取消全选&&&&&&& &/td&&&&&& &td align=&center&& 学号 &/td&&&&&& &td align=&center&& 姓名 &/td&&&& &/tr&&&& &tr&&&&&& &td&&input type=&checkbox& name=&no& value=&001& title=&选择/不选择&&&&&&& &/td&&&&&& &td& 001 &/td&&&&&& &td& 张三 &/td&&&& &/tr&&&& &tr&&&&&& &td&&input type=&checkbox& name=&no& value=&002& title=&选择/不选择&&&&&&& &/td&&&&&& &td& 002 &/td&&&&&& &td& 李四 &/td&&&& &/tr&& &/table&& &p align=&center&&&&& &input type=&button& name=&actionButton& value=&操作& onClick=&do_action()&&& &/p&&/form&&/body&&/html&
后台的取值方法:
String no[] = request.getParameterValues(&no&);
— dragonflyer @ 12:21 pm
1、确认CVSNT已经安装好,并能正常运行;WinCvs刚刚安装。
2、第一次运行WinCvs会弹出一个配置参数框。&&General标签的配置如下:&◇Authentication:pserver 选择认证方式,一般最常用的就是pserver&◇Path:/cvsroot 库文件所在的目录&◇Host address:10.87.170.99 CVSNT服务器的IP地址或计算机名&◇User name:administrator 第一次配置时用windows的管理员身份登陆,以便设置其他用户权限&◇CVSROOT:添好上面4项后会自动生成。
3、配置好后,登录。
4、建库:将已准备好的工程(可以是空的)&import moudule&到CVSNT服务器上的库中。
5、&check out&一个库下来,因为如果不下一个库下来,不能给这个库设置拥有者及权限。
6、选中新库的根目录,按【ctr+L】弹出命令框,依次执行一下命令:&◇cvs chacl default:r &&设置默认权限为只读。&◇cvs lsacl &&&&&&&&&&&&&&&&&& 列出所有的用户及其相应的权限(r 读 w 写 c 创建和删除)&◇cvs passwd -a cvspub &添加一个用户cvspub,删除一个用户的命令为cvs passwd -x cvspub&◇cvs chown cvspub &&&&&设置该库的拥有者&◇cvs chacl cvspub:rw &&设置用户cvspub的权限。要设置用户对某一个文件夹的权限,&先用鼠标在左边树型结构框中选中该文件夹,然后执行同样的命令。
— dragonflyer @ 12:15 pm}

我要回帖

更多关于 textfield 自动换行 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信