JAVA各种游戏大综合!各种特效

源代码在线查看: writeselect.js

软件大小: 1937 K
上传用户: dhgagfdagfdsdgf
关键词:
下载地址: 免注册下载 普通下载 VIP

相关代码

				function writeSelectBox(matrix, id, size, onchange, css) {
					var d = window.document;
				
					var ie4 = (document.all != null);
				
					if (ie4) {
				//		alert("Before!");
						var s = createIEString(matrix, id, size, onchange, css);
						document.write(s);
				//		alert("After!");
				//		alert(s);
					}
				
					else {
						document.write(createXString(matrix, id, size, onchange, css));
					}
				}
				
				function createIEString(matrix, id, size, onchange, css) {
					var str = "";
					// Span startTag	
						str += '						if (size == null)
							size = 1;
						str += ' size="' + size + '"';	
						if (id != null)
							str += ' id="' + id + '"';
						if (onchange != null)
							str += ' onchange="' + onchange + '"';
						if (css != null)
							str += ' style="' + css + '"';
						str += '>\n';
					
					// Table Tag
						str += '						str += ' onclick="toggleDropDown(this.parentElement)">\n';
						str += '\n';
						str += ' \n';
						str += '\n';
						str += '6\n';
						str += '\n';
						str += '\n';
						
					// DropDown startTag
						str += '\n';
						
						for (var i=0; i							html     = matrix[i].html;
							value    = matrix[i].value;
							css      = matrix[i].css;
							selected = matrix[i].selected;
							
						// Write option starttag
							str += '							if (value != null)
								str += ' value="' + value + '"';
							if (css != null)
								str += ' style="' + css + '"';
							if (selected != null)
								str += ' selected';
							str += '>\n';
							
						// Write HTML contents
							str += html;
						// Write end tag
							str += '\n';
						}
					
					//DropDown endtag
						str += '\n';
						
					// Span endTag
						str += '\n';
						
					return str;
				}
				
				function createXString(matrix, id, size, onchange, css) {
				//	var str = "\n";
					// form startTag
					var str = '\n';
					// Select startTag
					str += '					if (size == null)
						size = 1;
					str += ' size="' + size + '"';	
					if (id != null)
						str += ' id="' + id + '"';
					if (onchange != null)
						str += ' onchange="' + onchange + '"';
				//	if (css != null)
				//		str += ' style="' + css + '"';
					str += '>\n';
					// write options
					for (var i=0; i						html     = matrix[i].html;
						value    = matrix[i].value;
						css      = matrix[i].css;
						selected = matrix[i].selected;
						
					// Write option starttag
						str += '\n						if (value != null)
							str += ' value="' + value + '"';
				//		if (css != null)
				//			str += ' style="' + css + '"';
						if (selected != null)
							str += ' selected';
						str += '>';
						
					// Write HTML contents
						str += stripTags(html);
					// Write end tag
						str += '\n';
					}
					str += '\n\n';
					str += '\n';
				
					return str;
				}
				
				function stripTags(str) {
					var s = 0;
					var e = -1;
					var r = "";
				
					s = str.indexOf("				
					do {
						r += str.substring(e + 1,s);
						e = str.indexOf(">",s);
						s = str.indexOf("					}
					while ((s != -1) && (e != -1))
				
					r += str.substring(e + 1,str.length);
				
					return r;
				}
				
				function Option(html, value, css, selected) {
					this.html = html;
					this.value = value;
					this.css = css;
					this.selected = selected;
				}			

相关资源