我使用了一个插件来制作一个百分比加载器圈。 以下是初始化该插件后使用的js:
?DLL_PATH_FROM_PROGID("s.b")
FUNCTION DLL_PATH_FROM_PROGID(PAR_PROGID_STR)
LOCAL L_WSSH_OBJ As wscript.Shell
L_WSSH_OBJ = CreateObject("wscript.shell")
LOCAL L_CLSID_STR
L_CLSID_STR = CLSID_FROM_PROGID(PAR_PROGID_STR)
L_PATH_TO_DLL_STR = L_WSSH_OBJ.RegRead("HKEY_CLASSES_ROOT\CLSID\" + L_CLSID_STR + "\InProcServer32\")
L_ThreadingModel_STR = L_WSSH_OBJ.RegRead("HKEY_CLASSES_ROOT\CLSID\" + L_CLSID_STR + "\InProcServer32\ThreadingModel")
RELEASE loWSH
RETURN ALLTRIM(L_PATH_TO_DLL_STR)
ENDFUNC
&& ?CLSID_FROM_PROGID("s.b")
FUNCTION CLSID_FROM_PROGID(PAR_PROGID_STR)
*!* '--- Here's the registry path where we'll look up the CLSID which corresponds to the ProgID
LOCAL L_CLSID_PATH_STR, L_CLSID_STR
L_CLSID_PATH_STR = "HKEY_CLASSES_ROOT\" + PAR_PROGID_STR + "\CLSID\"
*!* '--- Create a WScript.Shell object
*!* Set oReg = WScript.CreateObject("WScript.Shell")
LOCAL L_WSSH_OBJ As wscript.Shell
L_WSSH_OBJ = CreateObject("wscript.shell")
*!* '--- Read the CLSID from the registry
*!* '--- If it doesn't exist, it will fail
*!* On Error Resume Next
*!* clsid = oReg.RegRead(clsidPath)
L_CLSID_STR = ALLTRIM(L_WSSH_OBJ.RegRead(L_CLSID_PATH_STR))
&& : L_CLSID_STR = COMCLASSINFO(MyO,4) && after MyO=CreateObject("s.b")
*!* If Err.Number <> 0 Then
*!* WScript.Echo "Error: Cannot open registry for speficied ProgID."
*!* WScript.Echo "Error: Please recheck your ProgID."
*!* WScript.Quit
*!* End If
RELEASE L_WSSH_OBJ
RETURN L_CLSID_STR
ENDFUNC
我希望用户更改百分比的值。为此,我使用了:
<script> </script>
现在我有来自用户的价值,但我不知道如何将其传递给插件。 我对jquery很新,并且在执行此操作时遇到了一些麻烦,
答案 0 :(得分:1)
您可以在点击处理程序中覆盖circliful
的某些选项:
var options = {
percent: 39
};
$("#test-circle").circliful(options);
$('#submit').on('click', function() {
var deg = $('#input').val();
options.percent = deg;
$("#test-circle").find('svg').remove();
$("#test-circle").circliful(options);
});
<强> Example 强>
P.S。:您在点击处理程序中使用ID submit
,如果此元素是提交按钮并且您要提交表单,则必须解决由表单提交触发的重新加载。在点击处理程序中使用e.prevenDefault
并提交表单,例如通过ajax
或保存百分比并在表单提交后应用它。如果这当然适用于您。