gpt4 book ai didi

html - Firebug 说不是一个功能

转载 作者:行者123 更新时间:2023-11-30 09:09:36 25 4
gpt4 key购买 nike

<script type = "text/javascript">
var First_Array = new Array();
function reset_Form2() {document.extraInfo.reset();}
function showList1() {document.getElementById("favSports").style.visibility="visible";}
function showList2() {document.getElementById("favSubjects").style.visibility="visible";}
function hideProceed() {document.getElementById('proceed').style.visibility='hidden';}

function proceedToSecond ()
{
document.getElementById("div1").style.visibility="hidden";
document.getElementById("div2").style.visibility="visible";
document.getElementById("favSports").style.visibility="hidden";
document.getElementById("favSubjects").style.visibility="hidden";
}

function backToFirst () {
document.getElementById("div1").style.visibility="visible";
document.getElementById("div2").style.visibility="hidden";
document.getElementById("favSports").style.visibility="visible";
document.getElementById("favSubjects").style.visibility="visible";
}

function reset_Form(){
document.personalInfo.reset();
document.getElementById("favSports").style.visibility="hidden";
document.getElementById("favSubjects").style.visibility="hidden";
}

function isValidName(firstStr) {
var firstPat = /^([a-zA-Z]+)$/;

var matchArray = firstStr.match(firstPat);
if (matchArray == null) {
alert("That's a weird name, try again");
return false;
}

return true;
}

function isValidZip(zipStr) {
var zipPat =/[0-9]{5}/;
var matchArray = zipStr.match(zipPat);
if(matchArray == null) {
alert("Zip is not in valid format");
return false;
}
return true;
}

function isValidApt(aptStr) {
var aptPat = /[\d]/;
var matchArray = aptStr.match(aptPat);
if(matchArray == null) {
if (aptStr=="") {
return true;
}
alert("Apt is not proper format");
return false;
}

return true;
}

function isValidDate(dateStr) {
//requires 4 digit year:

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

var matchArray = dateStr.match(datePat);
if (matchArray == null) {
alert("Date is not in a valid format.");
return false;
}
return true;
}

function checkRadioFirst() {
var rb = document.personalInfo.salutation;

for(var i=0;i<rb.length;i++) {
if(rb[i].checked) {
return true;
}
}
alert("Please specify a salutation");
return false;
}

function checkCheckFirst() {
var rb = document.personalInfo.operatingSystems;

for(var i=0;i<rb.length;i++) {
if(rb[i].checked) {
return true;
}
}
alert("Please specify an operating system") ;
return false;
}

function checkSelectFirst() {
if ( document.personalInfo.sports.selectedIndex == -1)
{
alert ( "Please select a sport" );
return false;
}
return true;
}

function checkRadioSecond() {
var rb = document.extraInfo.referral;

for(var i=0;i<rb.length;i++) {
if(rb[i].checked) {
return true;
}
}

alert("Please select form of referral");
return false;
}

function checkCheckSecond() {
var rb = document.extraInfo.officeSupplies;

for(var i=0;i<rb.length;i++) {
if(rb[i].checked) {
return true;
}
}
alert("Please select an office supply option");
return false;
}

function checkSelectSecond() {
if ( document.extraInfo.colorPick.selectedIndex == 0 ) {
alert ( "Please select a favorite color" );
return false;
}
return true;
}

function check_Form(){
var retvalue = isValidDate(document.personalInfo.date.value);
if(retvalue) {

retvalue = isValidZip(document.personalInfo.zipCode.value);
if(retvalue) {

retvalue = isValidName(document.personalInfo.nameFirst.value);
if(retvalue) {

retvalue = checkRadioFirst();
if(retvalue) {

retvalue = checkCheckFirst();
if(retvalue) {

retvalue = checkSelectFirst();
if(retvalue) {

retvalue = isValidApt(document.personalInfo.aptNum.value);
if(retvalue){
document.getElementById('proceed').style.visibility='visible';

var rb = document.personalInfo.salutation;

for(var i=0;i<rb.length;i++) {
if(rb[i].checked) {
var salForm = rb[i].value;
}
}

var SportsOptions = "";
for(var j=0;j<document.personalInfo.sports.length;j++){
if ( document.personalInfo.sports.options[j].selected){
SportsOptions += document.personalInfo.sports.options[j].value + " ";
}
}

var SubjectsOptions= "";
for(var k=0;k<document.personalInfo.subjects.length;k++){
if ( document.personalInfo.subjects.options[k].selected){
SubjectsOptions += document.personalInfo.subjects.options[k].value + " ";
}

}

var osBox = document.personalInfo.operatingSystems;
var OSOptions = "";
for(var y=0;y<osBox.length;y++) {
if(osBox[y].checked) {
OSOptions += osBox[y].value + " ";
}
}


First_Array[0] = salForm;
First_Array[1] = document.personalInfo.nameFirst.value;
First_Array[2] = document.personalInfo.nameMiddle.value;
First_Array[3] = document.personalInfo.nameLast.value;
First_Array[4] = document.personalInfo.address.value;
First_Array[5] = document.personalInfo.aptNum.value;
First_Array[6] = document.personalInfo.city.value;
for(var l=0; l<document.personalInfo.state.length; l++) {
if (document.personalInfo.state.options[l].selected) {
First_Array[7] = document.personalInfo.state[l].value;
}
}
First_Array[8] = document.personalInfo.zipCode.value;
First_Array[9] = document.personalInfo.date.value;
First_Array[10] = document.personalInfo.phone.value;
First_Array[11] = SportsOptions;
First_Array[12] = SubjectsOptions;
First_Array[13] = OSOptions;

alert("Everything looks good.");
document.getElementById('validityButton').style.visibility='hidden';
}
}
}
}
}
}
}
}

/*function formAction2() {
var retvalue;
retvalue = checkRadioSecond();
if(!retvalue) {
return retvalue;
}

retvalue = checkCheckSecond();
if(!retvalue) {
return retvalue;
}

return checkSelectSecond() ;
} */
</script>

这只是代码示例,还有很多功能,但我认为错误可能与周围代码有关。我完全不知道为什么,因为我知道所有周围的函数都会执行,并且会填充 First_Array。

但是,当我单击 Proceed to Second 按钮时,onclick 属性不会执行,因为 Firebug 说 proceedToSecond 不是函数

按钮代码:

<input type="button" id="proceed" name="proceedToSecond" onclick="proceedToSecond();" value="Proceed to second form">

最佳答案

我遇到了同样的问题,这是因为您有一个与您的函数同名的表单。 JavaScript 似乎无法区分两者,因此您会收到“不是函数”错误。

关于html - Firebug 说不是一个功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1425532/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com