|
Post by marcioc on Aug 29, 2010 18:43:43 GMT -5
who knows why this works: cls link #q,"aaa",[test] html "<script type=""text/javascript""> var a = null; var timer; var as = document.getElementsByTagName('A'); for (var i = 0; i < as.length; i++) { if (as.firstChild.data == 'aaa') { a = as; break; } } if (a) timer = setTimeout('location = a.href',500); </script>" wait [test] cls print "Worked"
and this does not work? cls link #q,"aaa",[test] html "<script type=""text/javascript""> function inform() { var a = null; var timer; var as = document.getElementsByTagName('A'); for (var i = 0; i < as.length; i++) { if (as.firstChild.data == 'aaa') { a = as; break; } } if (a) timer = setTimeout('location = a.href',500);} </script>" html "<form> <input type='button' name='testx' value='Click me' onclick='inform()'> </form>" wait [test] cls print "Worked"
Thanks in advance.
|
|
|
Post by StefanPendl on Aug 30, 2010 10:04:55 GMT -5
Functions used by form buttons must be placed into the head of the page, not the body, I think.
So you should use head "<script ... instead of html "<script ....
|
|
|
Post by marcioc on Aug 30, 2010 13:49:12 GMT -5
Thank you for the tip; however it did not work.
|
|
|
Post by marcioc on Aug 30, 2010 14:05:26 GMT -5
I just defined var a in the body of the java script and it worked. cls link #q,"aaa",[test] html "<script type=""text/javascript""> var a=null; function inform() { var timer; var as = document.getElementsByTagName('A'); for (var i = 0; i < as.length; i++) { if (as.firstChild.data == 'aaa') { a = as; break; } } if (a) timer = setTimeout('location = a.href',500); } </script> " html "<form> <input type='button' name='testx' value='Click me' onclick='inform()'> </form>" wait [test] cls print "Worked"
|
|