小编tsu*_*man的帖子

从动态创建的选项中设置选项"已选择"属性

我有一个使用javascript函数动态创建的选择选项.选择对象是

<select name="country" id="country">
</select>
Run Code Online (Sandbox Code Playgroud)

当执行js函数时,"country"对象是

<select name="country" id="country">
    <option value="AF">Afghanistan</option>
    <option value="AL">Albania</option>
    ...
    <option value="ID">Indonesia</option>
    ...
    <option value="ZW">Zimbabwe</option>
</select>
Run Code Online (Sandbox Code Playgroud)

并显示"Indonesia"作为默认选择选项.注意:selected="selected"该选项中没有属性.

然后我需要将selected="selected"属性设置为"Indonesia",我使用它

var country = document.getElementById("country");
country.options[country.options.selectedIndex].setAttribute("selected", "selected");
Run Code Online (Sandbox Code Playgroud)

使用萤火虫,我可以看到"印尼"选项是这样的

<option value="ID" selected="selected">Indonesia</option>
Run Code Online (Sandbox Code Playgroud)

但它在IE中失败(在IE 8中测试).

然后我尝试使用jQuery

$( function() {
    $("#country option:selected").attr("selected", "selected");
});
Run Code Online (Sandbox Code Playgroud)

它在FFX和IE中都失败了.

我需要"Indonesia"选项才能拥有selected="selected"属性所以当我点击重置按钮时,它会再次选择"Indonesia".

更改js功能以动态创建"country"选项不是一种选择.解决方案必须在FFX和IE中都能正常工作.

谢谢

javascript jquery select attributes option

60
推荐指数
8
解决办法
37万
查看次数

我在哪里可以找到用于创建组织结构图的jQuery或Ext插件?

我知道我们可以使用Google Chart Tools创建组织结构图.

但我的客户端服务器没有Internet连接.

是否有用于创建组织结构图的jQuery或Ext插件?

jquery charts extjs organization

7
推荐指数
1
解决办法
2万
查看次数

coldfusion奇怪的额外空间

我有一个函数将字符串转换为数字

<cffunction name="convertToNumber" returntype="numeric">
    <cfargument name="separator" required="Yes" type="string" />
    <cfargument name="number" required="Yes" type="string" />

    <cfset LOCAL.arrSeparator = ["comma", "period", "lakh_crore"] />

    <cfif ARGUMENTS.separator eq "comma" or ARGUMENTS.separator eq "lakh_crore">
        <cfif ListLen(ARGUMENTS.number, ".") eq 2>
            <cfset LOCAL.integral = ListFirst(ARGUMENTS.number, ".") />
            <cfset LOCAL.fractional = ListLast(ARGUMENTS.number, ".") />
        <cfelse>
            <cfset LOCAL.integral = ARGUMENTS.number />
            <cfset LOCAL.fractional = "" />
        </cfif>

        <cfset LOCAL.integral = Replace(LOCAL.integral, ",", "", "ALL") />
        <cfset LOCAL.returnValue = LOCAL.integral />

        <cfif Len(Trim(LOCAL.fractional))>
            <cfset LOCAL.returnValue &= "." & LOCAL.fractional /> …
Run Code Online (Sandbox Code Playgroud)

coldfusion cfc

7
推荐指数
1
解决办法
1228
查看次数

Firefox中的表单"未定义"错误

我有这个代码,让我们说吧 a.html

<form name="frmSubmit" id="frmSubmit" method="post">
<input type="hidden" name="hdnName" value="user name" />
</form>

<script>
// 1 : start
document.frmSubmit.action = 'b.html';
document.frmSubmit.submit();
// 1 : end

// 2 : start
document.getElementById("frmSubmit").action = 'b.html';
document.getElementById("frmSubmit").submit();
// 2 : end
</script>
Run Code Online (Sandbox Code Playgroud)

12在IE(IE 8)工作,而不是在FF(3.6.10).Firebug给我以下错误:

document.frmSubmit未定义

我该如何解决?

javascript forms

6
推荐指数
1
解决办法
8558
查看次数

SQL Server创建日期

我们可以使用SQL Server 2005创建日期吗?

例如,如果我有year = 2010,month = 11和day = 2,我如何将其转换或创建为datetime?

下面是我们用javascript写的

var date = new Date(2010, 10, 2, 0, 0, 0, 0);
Run Code Online (Sandbox Code Playgroud)

这是与oracle

SELECT TO_DATE('2010-11-02', 'YYYY-MM-DD') FROM DUAL
Run Code Online (Sandbox Code Playgroud)

谢谢

sql-server

5
推荐指数
1
解决办法
1万
查看次数

使用NLS_CHARACTERSET时的Oracle Unicode问题是WE8ISO8859P1和NLS_NCHAR_CHARACTERSET是AL16UTF16,而ColdFusion是编程语言

我有2个Oracle 10g数据库,XE和Enterprise

XE

在此输入图像描述

在此输入图像描述

企业

在此输入图像描述

在此输入图像描述

这是我在测试表中使用的数据类型

在此输入图像描述

在此输入图像描述

然后我尝试测试从http://www.sustainablegis.com/unicode/插入一些Unicode字符

结果是

XE

在此输入图像描述

企业

在此输入图像描述

对于此测试,我使用ColdFusion 9开发人员版

<cfprocessingDirective pageencoding="utf-8"> 
<cfset setEncoding("form","utf-8")>

<form action="" method="post">
Unicode : <br>
<textarea name="txaUnicode" id="txaUnicode" cols="50" rows="10"></textarea>
<br><br>
Language : <br>
<input type="Text" name="txtLanguage" id="txtLanguage">
<br><br>
<input type="Submit">
</form>

<cfset dsn = "theDSN">

<cfif StructKeyExists(FORM, "FIELDNAMES")>
    <cfquery name="qryInsert" datasource="#dsn#">
        INSERT INTO UNICODE
        (
            C_VARCHAR2,
            C_CHAR,
            C_CLOB,
            C_NVARCHAR2,
            LANGUAGE
        )
        VALUES
        (
            <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#FORM.TXAUNICODE#">,
            <cfqueryparam cfsqltype="CF_SQL_CHAR" value="#FORM.TXAUNICODE#">,
            <cfqueryparam cfsqltype="CF_SQL_LONGVARCHAR" value="#FORM.TXAUNICODE#">,
            <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#FORM.TXAUNICODE#">,
            <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#FORM.TXTLANGUAGE#">
        )
    </cfquery>
</cfif> …
Run Code Online (Sandbox Code Playgroud)

oracle unicode coldfusion character-encoding oracle10g

5
推荐指数
1
解决办法
1万
查看次数

jQuery datepicker显示佛教日期

是否有任何jQuery datepicker插件显示为佛教日期?

目前我使用jQuery UI datepicker来显示它,但实际上并不是我想要的.这是代码:

$(document).ready( function() {
    $("#datepicker").datepicker( {
        appendText: ' yyyy-mm-dd',
        autoSize: true,
        buttonImage: 'images/calendar.gif',
        buttonImageOnly: true,
        changeMonth: true,
        changeYear: true,
        dateFormat: 'yy-mm-dd',
        showOtherMonths: true,
        selectOtherMonths: true,
        showOn: 'both',
        onSelect: function(dateText, inst) {
            year = dateText.substring(0, 4);
            month = dateText.substring(5, 7);
            day = dateText.substring(8);
            _year = parseInt(year) + 543 + '';
            $(this).val(_year + '-' + month + '-' + day);
        },
        beforeShow: function(input, inst) {
            year = input.value.substring(0, 4);
            month = input.value.substring(5, 7);
            day = input.value.substring(8);
            _year …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-ui jquery-plugins jquery-ui-datepicker

1
推荐指数
1
解决办法
1万
查看次数