以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]AddUploader能否通过javascript更改属性  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=125017)

--  作者:ajie5211
--  发布时间:2018/9/18 13:17:00
--  [求助]AddUploader能否通过javascript更改属性

如下面定义了名片正面的浏览,能否通过javascript文件来打开AllowDelete和Incremental属性,并修改AllowAdd为true

With wb.AddInputGroup("form1","ipg1","名片正面") \'文件上传
                    With .AddUploader("名片正面","",True)
                        \'.AllowDelete = True \'允许删除
                        \'.Incremental = False \'允许重复选择文件或连续拍照
                        .AllowAdd = False \'关闭文件上传功能
                        .AddImage("./images/" & mpzmn)
                    End With
                End With
做了一个查看详情页面,想直接在这个页面中通过按钮来调用javascript文件,打开可修改的功能,修改后保存,直接开一个新编辑页面,图片传来传去的,感觉流量太浪费了。


--  作者:有点甜
--  发布时间:2018/9/18 14:48:00
--  

 

不可以,设置的属性不同,生成的html代码不同的。你可以都设置成true的方式(可以编辑的方式),然后用js控制隐藏/显示某一些元素。

 


--  作者:ajie5211
--  发布时间:2018/9/18 16:07:00
--  
以下是引用有点甜在2018/9/18 14:48:00的发言:

 

不可以,设置的属性不同,生成的html代码不同的。你可以都设置成true的方式(可以编辑的方式),然后用js控制隐藏/显示某一些元素。

 

With .AddUploader("名片正面","",True)
                        .AllowDelete = True \'允许删除
                        .Incremental = False \'允许重复选择文件或连续拍照
                        .AllowAdd = True \'关闭文件上传功能
                        .AddImage("./images/" & mpzmn)
                    End With
哪如果刚开始这样建了上传图,在刚打开时,JS怎么控制不显示上传按钮和删除按钮哪?


--  作者:有点甜
--  发布时间:2018/9/18 16:56:00
--  
Select Case e.Path
    Case "test.htm", ""
        Dim wb As New weui
        wb.AddForm("","form1","123.htm?test=123abc") \'指定接收表单数据的的页面为handle.htm
        With wb.AddInputGroup("form1","ipg1","客户资料")
            .AddInput("姓名","姓名","text").value = "舒淇"
            .AddInput("地点","地点","text").Value = "蒙古草原"
            .AddInput("日期","日期","date").value = #10/12/2012#
            With .AddUploader("up1","",True)
                .AllowDelete = True \'允许删除
                .Incremental = False \'允许重复选择文件或连续拍照
                .AllowAdd = True \'关闭文件上传功能
                .AddImage("./images/001.jpg")
                .AddImage("./images/002.jpg")
                .AddImage("./images/003.jpg")
            End With
        End With
        wb.AppendHTML("<script>up1.parentNode.style.display=\'none\';up1_gallery.children[1].children[0].children[0].style.display=\'none\'</script>")
        e.WriteString(wb.Build)
End Select

--  作者:ajie5211
--  发布时间:2018/9/19 9:14:00
--  

删除按钮隐藏后,JS怎么不能再显示回来啊?

 document.getElementById("名片正面").parentNode.style.display = "block";
 document.getElementById("名片正面_gallery.children[1].children[0].children[0]").style.display = "block";   这里出错
 document.getElementById("名片反面").parentNode.style.display = "block";
 document.getElementById("名片反面_gallery.children[1].children[0].children[0]").style.display = "block";   这里出错
 document.getElementById("btn2").style.display="block";  
 document.getElementById("btn1").style.display="block"; 
 document.getElementById("btnedit").style.display="none";


--  作者:有点甜
--  发布时间:2018/9/19 10:04:00
--  

我测试没问题

 

Select Case e.Path
    Case "test.htm", ""
        Dim wb As New weui
        wb.AddForm("","form1","123.htm?test=123abc") \'指定接收表单数据的的页面为handle.htm
        With wb.AddInputGroup("form1","ipg1","客户资料")
            .AddInput("姓名","姓名","text").value = "舒淇"
            .AddInput("地点","地点","text").Value = "蒙古草原"
            .AddInput("日期","日期","date").value = #10/12/2012#
            With .AddUploader("up1","",True)
                .AllowDelete = True \'允许删除
                .Incremental = False \'允许重复选择文件或连续拍照
                .AllowAdd = True \'关闭文件上传功能
                .AddImage("./images/001.jpg")
                .AddImage("./images/002.jpg")
                .AddImage("./images/003.jpg")
            End With
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "确定", "button").Attribute = "onclick=""up1_gallery.children[1].children[0].children[0].style.display=\'block\'"""
        End With
        wb.AppendHTML("<script>up1.parentNode.style.display=\'none\';up1_gallery.children[1].children[0].children[0].style.display=\'none\'</script>")
        e.WriteString(wb.Build)
End Select


--  作者:有点甜
--  发布时间:2018/9/19 10:05:00
--  

你的代码要改成类似

 

document.getElementById("名片正面_gallery").children[1].children[0].children[0].style.display = "block";  


--  作者:ajie5211
--  发布时间:2018/9/19 11:25:00
--  

取消文本框的只读属性怎么没有用哪?也不提示错误,就是没有改变只读。

function xgzt(){
 document.getElementById("名片正面").parentNode.style.display = "block";
 document.getElementById("名片正面_gallery").children[1].children[0].children[0].style.display = "block";
 document.getElementById("名片反面").parentNode.style.display = "block";
 document.getElementById("名片反面_gallery").children[1].children[0].children[0].style.display = "block";
 document.getElementById("btn2").style.display="block";  
 document.getElementById("btn1").style.display="block"; 
 document.getElementById("btnedit").style.display="none";
 document.getElementById("company").readonly=false;
 document.getElementById("na").readonly=false;
 document.getElementById("job").readonly=false;
 document.getElementById("mobile").readonly=false;
 document.getElementById("fax").readonly=false;
 document.getElementById("tel").readonly=false;
 document.getElementById("mail").readonly=false;
 document.getElementById("url").readonly=false;
 document.getElementById("addr").readonly=false;
 document.getElementById("bz").readonly=false;
}


--  作者:有点甜
--  发布时间:2018/9/19 11:36:00
--  

注意大小写 http://www.w3school.com.cn/jsref/prop_text_readonly.asp