Weebly纽扣坏了

时间:2016-10-04 09:50:01

标签: html forms button weebly

我试图让登录按钮工作按下输入任一字段发布表单和按钮出现但什么都不做。这是代码,任何想法? 提前一堆谢谢!

<script type="text/javascript">

function loadjsfile(filename, filetype){
    if (filetype=="js"){ //if filename is a external JavaScript file
        var fileref=document.createElement('script')
        fileref.setAttribute("type","text/javascript")
        fileref.setAttribute("src", filename)
    }
    if (typeof fileref!="undefined")
        document.getElementsByTagName("head")[0].appendChild(fileref)
}

var hour = new Date().getHours(); 
loadjsfile("http://my.domain/js/util.js?v="+hour, "js");

</script>

2 个答案:

答案 0 :(得分:1)

没有链接到表单的动作..填写action =“”链接到你的PHP页面日志。

答案 1 :(得分:0)

你需要一些使用.wsite-button-inner的jQuery来处理你的<input type="sumbmit">。因为您将输入按钮隐藏在屏幕外。当使用java脚本来处理它以获得精美的按钮时,最佳做法是添加JavaScript验证(未在代码中显示)。

即:document.getElementById("login").submit();

&#13;
&#13;
function submitform()
{
  document.login.submit();
}
&#13;
<div><form id="login" action="" method="POST">
<div id="login-form-parent" class="wsite-form-container" style="margin-top: 0px;margin-right: 0px; margin">
<h2 class="wsite-content-title" style="text-align: center;">
<span style="font-size: large;">Please enter your credentials</span></h2>
<div>
<div style= "text-align: center";>
<label class="wsite-form-label" for="name">Username</label>
<div>
<input id="input-616817079299148233" class="wsite-form-input wsite-input wsite-input-width-370px" name="username" type="text" />
</div>
</div>
</div>
<div style="margin-top: 15px;margin-bottom: 15px;"></div>
<div>
<div style="text-align: center";>
<label class="wsite-form-label" for="password">Password</label>
<div>
<input id="input-984837360768012607" class="wsite-form-input wsite-input wsite-input-width-370px" name="pwd" type="password" />
</div>
</div>
</div>
</div>
<div style="display: none; visibility: hidden;"><input name="wsite_subject" type="text" />
</div>
<div style="text-align: center; margin-top: 10px; margin-bottom: 0px;">
<input name="form_version" type="hidden" value="2" />
<input id="wsite-approved" name="wsite_approved" type="hidden" value="approved" /> 
<input name="ucfid" type="hidden" value="login" />
<input style="position: absolute; top: 0; left: -9999px; width: 1px; height: 1px;" type="submit" />
<a href="javascript: submitform()" class="wsite-button">
<span class="wsite-button-inner">Submit</span></a></div>
</form></div>
&#13;
&#13;
&#13;

内联HTML:

&#13;
&#13;
<div><form id="login" action="" method="POST">
<div id="login-form-parent" class="wsite-form-container" style="margin-top: 0px;margin-right: 0px; margin">
<h2 class="wsite-content-title" style="text-align: center;">
<span style="font-size: large;">Please enter your credentials</span></h2>
<div>
<div style= "text-align: center";>
<label class="wsite-form-label" for="name">Username</label>
<div>
<input id="input-616817079299148233" class="wsite-form-input wsite-input wsite-input-width-370px" name="username" type="text" />
</div>
</div>
</div>
<div style="margin-top: 15px;margin-bottom: 15px;"></div>
<div>
<div style="text-align: center";>
<label class="wsite-form-label" for="password">Password</label>
<div>
<input id="input-984837360768012607" class="wsite-form-input wsite-input wsite-input-width-370px" name="pwd" type="password" />
</div>
</div>
</div>
</div>
<div style="display: none; visibility: hidden;"><input name="wsite_subject" type="text" />
</div>
<div style="text-align: center; margin-top: 10px; margin-bottom: 0px;">
<input name="form_version" type="hidden" value="2" />
<input id="wsite-approved" name="wsite_approved" type="hidden" value="approved" /> 
<input name="ucfid" type="hidden" value="login" />
<input style="position: absolute; top: 0; left: -9999px; width: 1px; height: 1px;" type="submit" />
<a href="javascript: submitform()" class="wsite-button">
<span class="wsite-button-inner">Submit</span></a></div>
</form></div>
<script type="text/javascript">
function submitform()
{
document.login.submit();
}
</script>
&#13;
&#13;
&#13;