首页 > 解决方案 > 输入范围滑块值应指向页面加载时 cgi 脚本值的输出

问题描述

我有一个在cgi script其中运行bash script并获得一个值作为输出的值。现在我希望在最初加载页面时将该值(的输出cgi)分配给输入范围滑块的值。HTML我该如何做到这一点?

Minimum Length<br><input type="range" id="Minlen_range" name="MinlenRange" min="0" max="100" value="8" oninput="this.form.MinlenInput.value=this.value" />
<input type="number" id="Minlen_text" name="MinlenInput" min="0" max="100" value="8" oninput="this.form.MinlenRange.value=this.value" />

下面是 CGI 脚本(testing.cgi)

 #!/bin/bash 
 echo "Content-type: text/html" 
 echo "" 
 echo "<html><head><title>Bash as CGI" echo "</title></head><body>"

 echo "<h3>Minimum Password Lenght</h3>" echo "<pre>
 $(/usr/local/bin/Propertyhandler getConfiguration minlen) </pre>"

现在,在 html 页面中,默认值设置为 8,但我希望 value 属性应该指向 cgi 脚本的输出值。

标签: javascripthtmlbashcgi

解决方案


推荐阅读