Jump to content

a lil help with an alert issue


Go to solution Solved by calmchess,

Recommended Posts

I have the following code and for some reason the last line before the alert will only execute properly if I have the alert there without the alert it doesn't work. Why? I have seen this phenomenon other places in my codes too does it indicate anything significant when I debug code?

 

 

 

var select0 = document.getElementById("subhead00");

var select00=select0.options;

var spansinputs0=document.getElementsByClassName(""+slotid0+"");

var getvalueinner0=spansinputs0[0].value;

switchID0=0;

subID0="";

if(dbid00<=12){

select00=getvalueinner0;

alert();
Link to comment
https://forums.phpfreaks.com/topic/276451-a-lil-help-with-an-alert-issue/
Share on other sites

Hmm, that code is not valid - there is no closing curly brace to match the opening curly brace after the if() condition. I assume there is more code since the line before the alert is simply an assignment and doesn't do anything. So, you must have other code that uses that value which is not working as you expect. Assuming the format errors above are just due to a lack of the entire code the only thing that comes to mind is that some of the code is dependent upon some other process completing first and the alert allows that to complete before you click "OK". It could even be an issue with field focus. Once the alert pops up and you click OK your focus may change allowing the process to complete successfully. Basically, you haven't shared enough of the code to really understand the problem.

change:function(e){

e.preventDefault();

var slotid0=e.target.getAttribute("id");

var slotid00=slotid0;

var bind1="";

var dbid0 = ((slotid0.length>6)?slotid0.substring(5,7):slotid0.substring(5,8));

var dbid00=Number(dbid0)+1;

var select0 = document.getElementById("subhead00");

var select00=select0.options;

var spansinputs0=document.getElementsByClassName(""+slotid0+"");

var getvalueinner0=spansinputs0[0].value;

switchID0=0;

subID0="";

if(dbid00<=12){

select00=getvalueinner0;

bind0=getvalueinner0;

switchID0=2;

}else{

switchID0=1;

subID0=select0.value;

//dbid00=dbid00%12;

alert(subID0);

//if(dbid00==0){dbid00=12;}

}

//change sub values

if(select0.value!="Kies Categorie"){ 

bind0=select0.value;

}

 

for(var j=12;j<24;j++){

var spansinputs0=document.getElementsByClassName("catid"+""+j+"");

var getvalueinner0=((spansinputs0[0].value)?spansinputs0[0].value:spansinputs0[0].innerHTML);

if(getvalueinner0!=""){

bind1=bind1+getvalueinner0+":::";

 

}

}

if(document.getElementsByTagName("input").length>0){

ajax.callserv('http://localhost/elance/admin_console/secure_php/changecustregcats.php' adminconsoleui.refreshspan,bind0,bind1,slotid0,dbid00,subID0,switchID0);

 

}

},
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.