Jump to content

followup to my error on Iphone using js


ginerjm

Recommended Posts

ok - nobody seems to know much about js on the iphone - errors that is.  So - in the meantime I've been experimenting and come up with this so far.

function CopyResult()
{
var x=document.getElementById("curdirs").value;
try
  {
1	var str = x;
2	var arstr = str.split(" ");
3	if (arstr.length >1)
	{
4		document.getElementById("mntstsy").checked = true;
	}
5	else
	{
6		document.getElementById("mntstsn").checked = true;
	}
7	str = arstr.shift();

8              alert("shift done- now using: "+str);
  	
9               document.getElementById("uid").value =str;
10  	alert("set uid");

 

This function is called from an html "select" tag using the onchange event.  I've tried several alerts in the function and find that I'm getting thru it up until I try to set the "uid" input tag in line 9 with the value in the var "str".  The alert following this line doesn't get executed.  I do know that I have values that are good as I've seen them using alerts, and I can see that the actions performed by lines 4 or 6 get performed.  But then it dies giving me an error message of "undefined".

 

Does anyone have a clue why line 9 fails on safari (iphone) and runs just fine on IE?

Link to comment
https://forums.phpfreaks.com/topic/231897-followup-to-my-error-on-iphone-using-js/
Share on other sites

But then it dies giving me an error message of "undefined".

 

Take a look at my response to one of your other posts. If you were using the same error handling here as you were there, you would have gotten a better error message and solved this instantly.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.