Irmawaty
asked on
executing javascript using webbrowser control
Hello experts,
I am wondering if anyone knows how to call and execute a javascript function from webbrowser control.
so far I have:
HTMLDocument myDoc = new HTMLDocumentClass();
myDoc = (HTMLDocument) axWebBrowser1.Document;
I am wondering if anyone knows how to call and execute a javascript function from webbrowser control.
so far I have:
HTMLDocument myDoc = new HTMLDocumentClass();
myDoc = (HTMLDocument) axWebBrowser1.Document;
Put the javascript in your page. Load your page in the browser. :)
ASKER
Chaosian,
Sorry I didn't explain my question very well. What i am intending to do here is doing web automation. There is a link look like this: <a href="javascript:chooseGro ups('sss', 'sss')">Ch oose item</a>.
For some reasons, using the following codes:
HTMLDocument myDoc = new HTMLDocumentClass()
IHTMLElementCollection eventLinks = myDoc.links
I only get a list of links that is outside of <form> tag. So I try to work around this by calling the javascript instead.
Here is what I have now:
object loc = "https://www.aaa.com/";
object null_obj_str = "";
System.Object null_obj = 0;
this.axWebBrowser1.Navigat e2(ref loc , ref null_obj, ref null_obj, ref null_obj_str, ref null_obj_str);
HTMLDocument myDoc = new HTMLDocumentClass();
myDoc = (HTMLDocument) axWebBrowser1.Document;
Sorry I didn't explain my question very well. What i am intending to do here is doing web automation. There is a link look like this: <a href="javascript:chooseGro
For some reasons, using the following codes:
HTMLDocument myDoc = new HTMLDocumentClass()
IHTMLElementCollection eventLinks = myDoc.links
I only get a list of links that is outside of <form> tag. So I try to work around this by calling the javascript instead.
Here is what I have now:
object loc = "https://www.aaa.com/";
object null_obj_str = "";
System.Object null_obj = 0;
this.axWebBrowser1.Navigat
HTMLDocument myDoc = new HTMLDocumentClass();
myDoc = (HTMLDocument) axWebBrowser1.Document;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry,
still to no avail...
still to no avail...
hmmm...that code worked fine for me and I used experts-exchange live html over the net. Could you possibly post your entire code that involves this?
More questions: Is you <a> tag controlled by you? Could you post the entire html file? And will it ever change?
More questions: Is you <a> tag controlled by you? Could you post the entire html file? And will it ever change?
Also:
Are you getting an error you just not getting anything clicked?
Are you getting an error you just not getting anything clicked?
Hey I think I know what it is: If you're running XP SP 2 and try to click a link that is formatting like so:
<a href="javascript:alert('he llo');">He llo</a>
IE will ask for permission before executing the code....the web control in .NET may not allow this interacting and therefore just not execute the click. If you can control the format of the link, try doing something like this instead:
<a href="#" onclick="javascript:choose Groups('ss s','sss')" >Choose item</a>.
And see if that works.
<a href="javascript:alert('he
IE will ask for permission before executing the code....the web control in .NET may not allow this interacting and therefore just not execute the click. If you can control the format of the link, try doing something like this instead:
<a href="#" onclick="javascript:choose
And see if that works.
nevermind...I just tried it and it worked fine. Just answer the previous comments before my last one.
ASKER
There is no <a> tag with the href that I want to click. Thus, it never enters the if statement.
I don't control <a>, I just retrieve the HTML code
Here is the editted version of the HTML code: (the link that I am talking about is in <FORM> called "Item group")
<HTML>
<HEAD><TITLE></TITLE>
</HEAD>
<BODY LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<script language="Javascript" src="/include/dropmenu.js" ></script>
<!-- BEGIN HEADER HTML -->
--CONTAINS THE LINKS THAT SHOWS UP IN IHTMLElementCollection
<!-- END HEADER HTML -->
<!--API Render Time End New Header: 78ms -->
<!--API Render Time: 94ms -->
<table height="100%" width="100%" cellpadding=0 cellspacing=0 border=0>
<tr>
<td valign="top" width="150" NOWRAP >
--CONTAINS LINKS THAT DO NOT SHOW IN IHTMLElementCollection
</td>
</tr>
<form name="eventmaintenance" action="/xxx/eventcalendar /event_mai ntenance.a sp?ch=H3&d iv=1&appTy pe=xxx" method="POST">
<form name="eventmaintenance" action="/xxx/xxx/event_mai ntenance.a sp?ch=H3&d iv=1&appTy pe=xxx" method="POST">
<table width="100%" bgcolor='#ffffff' border="0">
<input type=Hidden name='Action'>
<input type=Hidden name='EventId' value="-1">
<input type=Hidden name='ParentId' value="">
<input type=Hidden name='CopyFromEventId' value="">
<input type=Hidden name='OldEventId' value="-1">
<input type=Hidden name='Level' value="">
<tr><td align="CENTER" valign="MIDDLE" class="subDark" bgcolor="#3366FF">Describe Event</td></tr>
<tr>
<td>
<table width="100%" border="0">
<tr>
<td class="sub">Name:</td>
<td><input type="Text" name="EventName" value="" maxlength="40" size="20"></td>
<td class="sub">Description</t d>
<td ><input type="Text" name="EventDesc" value="" maxlength="255" size="45"><br><font size=-3>(max of 255 characters)</font></td>
</tr>
</tr>
<tr>
<td class="sub">Event Category:</td>
<td>
<select name="EventCategory" onchange="refreshFromFormD ata()">
<option value="">--Choose--</optio n>
<option value="9">option1 </option>
<option value="13">option2 </option>
<option value="18">option3 </option>
<option value="27">option4 </option>
</select>
</td>
<td class="sub">Event<br>Type Code:</td>
<td>
<select name="EventTypeCode">
<option value="">--Choose--</optio n>
</select></td>
</tr>
</table>
</td></tr>
<tr><td align="CENTER" valign="MIDDLE" class="subDark" bgcolor="#3366FF">Time Occurrence</td></tr>
<tr><td>
<table width="100%" border="0">
<tr>
<td class="sub">Event Occurance:</td>
<td class="sub"><input type="radio" checked onClick="form.submit()" name="OccuranceType" value="-1">Once<input type="radio" onClick="form.submit()" name="OccuranceType" value="0">Annually</td>
<td></td><td></td></tr>
</table>
<table id="oncerows" width="100%" border="0">
<tr>
<td></td>
<td class="sub">Event<br>Begin Date:</td>
<td>
<SELECT name="BeginDateYYYY" onchange="changeSelectionD ays('event maintenanc e','Begin' )"></SELEC T>
<SELECT name="BeginDateMM" onchange="changeSelectionD ays('event maintenanc e','Begin' )"></SELEC T>
<SELECT name="BeginDateDD" onchange="changeSelectionD ays('event maintenanc e','Begin' )"></SELEC T></td>
<td></td></tr>
<tr>
<td class="sub"></td><td class="sub">Event<br>End Date:</td>
<td>
<SELECT name="EndDateYYYY" onchange="changeSelectionD ays('event maintenanc e','End')" ></SELECT>
<SELECT name="EndDateMM" onchange="changeSelectionD ays('event maintenanc e','End')" ></SELECT>
<SELECT name="EndDateDD" onchange="changeSelectionD ays('event maintenanc e','End')" ></SELECT> </table>
</td></tr>
<tr>
<td nowrap class="normal"><input size="9" name="mdseId" value="" type="text"><input name="mdseDesc" size="30" type="text" value=""> <a class=bold href="javascript:chooseGro ups('item' ,'-1')">It em group</a>
<td></td>
</tr>
</table>
</form>
</td></tr></table></td></t r></table>
</body></html>
<SCRIPT LANGUAGE="JavaScript">
var bDecided = false;
var bSeries = true;
var bOccChange = false;
var bChild = eval("false");
var ParentID = "";
var parent_EventName = "";
var parent_EventStatus = "";
var parent_EventDesc = "";
var parent_EventTypeCode = "";
var parent_OwnerTypeCode = "";
var g_action;
var myTimeOut;
function refreshFromFormData() {
document.eventmaintenance. Action.val ue = "PULLFROMFORM";
document.eventmaintenance. submit();
}
function open_popupCOE(value,EventI d,ch,div,A PPTYPE,mds e_level_id ,bu_group_ id,mdseLev el)
{
var url = "/xxx/xxx/event_createCOE. asp?ch="+c h+"&div="+ div+"&appT ype="+APPT YPE+"&call er=event_m aintenance .asp&Event Id=" +EventId+ "&mdseId=" + mdse_level_id+ "&bu_group_id=" + bu_group_id + "&mdseLevel=" + mdseLevel+"&Type="+value+" ";
window.location = url;
}
function clearForm() {
document.eventmaintenance. EventId.va lue = "-1";
document.eventmaintenance. Action.val ue = "CLEAR";
document.eventmaintenance. submit();
}
function bCreateNewEvent()
{
return (parent_EventStatus == "2" && document.eventmaintenance. EventStatu s.options[ document.e ventmainte nance.Even tStatus.se lectedInde x].value != parent_EventStatus);
}
function areYouSure()
{
if(bCreateNewEvent())
if(confirm("By continuing, this action will create a new one time event. Are you sure you want to continue?"))
decided(false);
else
clearTimeOut();
else
decided(false);
}
function decided(bChoice)
{
bSeries = bChoice;
bDecided = true;
}
function checkStatus()
{
if(!bDecided){
myTimeOut = setTimeout("checkStatus()" , 500);
}
else{
if(!document.layers)
hide_modifyOccurrenceOrSer iesPopup(" modOcc");
clearTimeOut();
if(validateForm()){
if(bSeries){
g_action = "MODIFYSERIESOCCURRENCE";
if(bOccChange)
alert("Occurrence information can only be changed from the event that begins the series. All other changes will be applied to the series.");
}
else{
if(bCreateNewEvent()){
if(!bOccChange)
{
//lsirvin added this line to put the current EventId value into the OldEventId value.
document.eventmaintenance. OldEventId .value = document.eventmaintenance. EventId.va lue;
document.eventmaintenance. EventId.va lue = "-1";
}
g_action = "CREATEFROMOCCURRENCE";
}
}
document.eventmaintenance. Action.val ue = g_action;
document.eventmaintenance. submit();
}
}
}
function clearTimeOut()
{
clearTimeout(myTimeOut);
}
function submitForm(action) {
var bGood = false;
LEVEL = "";
switch(action){
case "CREATE":
bGood = (validateForm()) ? validateImpact() : false;
break;
case "MODIFYSERIES":
bGood = validateForm();
break;
case "ADDIMPACT":
bGood = validateImpact();
if (document.eventmaintenance .ImpactVal ue.value== "")
action = "ADDLEVEL";
document.eventmaintenance. action += "\#level";
break;
case "ADDIMPACTSERIES":
bGood = validateImpact();
if (document.eventmaintenance .ImpactVal ue.value== "")
action = "ADDLEVELSERIES";
document.eventmaintenance. action += "\#level";
break;
default:
bGood = true;
break;
}
if (bGood) {
document.eventmaintenance. Level.valu e=LEVEL;
document.eventmaintenance. Action.val ue=action;
document.eventmaintenance. submit();
}
}
if(document.eventmaintenan ce.mdseId. value==""& &document. eventmaint enance.mds eLevel[doc ument.even tmaintenan ce.mdseLev el.selecte dIndex].va lue != 0) {
alert("The identifier field cannot be empty.");
bGood = false;
}
if(!isRealNumber(document. eventmaint enance.buI d.value)) {
alert("xxxx");
bGood = false;
}
return bGood;
}
function validateForm() {
var bGood = true;
//Check Describe Event
if (document.eventmaintenance .EventType Code.optio ns[documen t.eventmai ntenance.E ventTypeCo de.selecte dIndex].va lue=="") { bGood=false; }
if (RTrim(document.eventmaint enance.Eve ntDesc.val ue)=="") { bGood=false; }
if (RTrim(document.eventmaint enance.Eve ntName.val ue)=="") { bGood=false; }
if (!bGood) { alert("Fill in all Event Description fields."); }
//Check Time Occurance
if (document.eventmaintenance .Occurance Type[0].ch ecked) { //Once
var begin = new Date(document.eventmainten ance.Begin DateMM.opt ions[docum ent.eventm aintenance .BeginDate MM.selecte dIndex].va lue + "/" + document.eventmaintenance. BeginDateD D.options[ document.e ventmainte nance.Begi nDateDD.se lectedInde x].value + "/" + document.eventmaintenance. BeginDateY YYY.option s[document .eventmain tenance.Be ginDateYYY Y.selected Index].val ue);
var end = new Date(document.eventmainten ance.EndDa teMM.optio ns[documen t.eventmai ntenance.E ndDateMM.s electedInd ex].value + "/" + document.eventmaintenance. EndDateDD. options[do cument.eve ntmaintena nce.EndDat eDD.select edIndex].v alue + "/" + document.eventmaintenance. EndDateYYY Y.options[ document.e ventmainte nance.EndD ateYYYY.se lectedInde x].value);
if (end < begin) {
alert("Event End Date must be after Event Begin Date.");
bGood = false;
}
} else if (document.eventmaintenance .Occurance Type[1].ch ecked) { //Annual
if (document.eventmaintenance .AnnuallyT ype[0].che cked) { //Exact Day
if (document.eventmaintenance .SpecificD ateMonth.o ptions[doc ument.even tmaintenan ce.Specifi cDateMonth .selectedI ndex].valu e=="-1" || document.eventmaintenance. SpecificDa teDay.opti ons[docume nt.eventma intenance. SpecificDa teDay.sele ctedIndex] .value=="- 1") {
alert("Choose Exact Day Info.");
bGood=false;
}
} else if (document.eventmaintenance .AnnuallyT ype[1].che cked) { //Day of Week
if (document.eventmaintenance .DayWhichW eek.option s[document .eventmain tenance.Da yWhichWeek .selectedI ndex].valu e=="-1" || document.eventmaintenance. DayWhichDa y.options[ document.e ventmainte nance.DayW hichDay.se lectedInde x].value== "-1" || document.eventmaintenance. DayWhichMo nth.option s[document .eventmain tenance.Da yWhichMont h.selected Index].val ue=="-1") {
alert("Choose Day of Week Info.");
bGood=false;
}
} else if (document.eventmaintenance .AnnuallyT ype[2].che cked) { //Holiday
if (document.eventmaintenance .HolidayCo de.options [document. eventmaint enance.Hol idayCode.s electedInd ex].value= ="-1") {
alert("Choose Holiday Info.");
bGood=false;
}
} else {
alert("Fill in Event Time Occurrance.");
bGood = false;
}
if (document.eventmaintenance .DaysBefor eEvent.val ue==""||do cument.eve ntmaintena nce.DaysAf terEvent.v alue=="") {
alert("Fill in Before/After Days fields.");
bGood = false;
}
if (document.eventmaintenance .RemindDay s.value==" ") {
alert("Fill in Remind Days.");
bGood = false;
}
if (!document.eventmaintenanc e.EndCode[ 0].checked && !document.eventmaintenance .EndCode[1 ].checked) {
alert("Select when event ends.");
bGood = false;
}
if (document.eventmaintenance .EndCode[1 ].checked && document.eventmaintenance. Occurrance Count.valu e=="") {
alert("Choose in how many years the Event will end.");
bGood = false;
}
document.eventmaintenance. DaysBefore Event.valu e = document.eventmaintenance. DaysBefore Event.valu e.replace( ",","");
document.eventmaintenance. DaysAfterE vent.value = document.eventmaintenance. DaysAfterE vent.value .replace(" ,","");
document.eventmaintenance. RemindDays .value = document.eventmaintenance. RemindDays .value.rep lace(","," ");
document.eventmaintenance. Occurrance Count.valu e = document.eventmaintenance. Occurrance Count.valu e.replace( ",","");
if (!isRealNumber(document.ev entmainten ance.DaysB eforeEvent .value)||! isRealNumb er(documen t.eventmai ntenance.D aysAfterEv ent.value) ||!isRealN umber(docu ment.event maintenanc e.RemindDa ys.value)| |!isRealNu mber(docum ent.eventm aintenance .Occurranc eCount.val ue)) {
alert("Time Occurrance Fields must be whole numbers.");
bGood = false;
}
}
return bGood;
}
function clearLevelFields() {
document.eventmaintenance. mdseId.val ue="";
document.eventmaintenance. mdseDesc.v alue="";
document.eventmaintenance. buId.value ="";
document.eventmaintenance. buDesc.val ue="";
document.eventmaintenance. ImpactValu e.value="" ;
}
function makeSelectedIndexZero(fiel d) {
eval("document.eventmainte nance." + field + ".selectedIndex=0;");
}
function chooseGroups(which,EventId ) {
if (EventId!="-1") {
var url = "/xxx/xxx/" + which + "_group.asp?ch=H3&div=1&ap pType=xxx& EventId=-1 &mdseLevel =" + document.eventmaintenance. mdseLevel. value + "&mdseId=" + document.eventmaintenance. mdseId.val ue + "&buId=&xxxmdseId=&xxxbuId =";
//alert(url);
window.location = url;
} else { //Save event so they can choose item group for impact
if (validateForm()) {
var action;
if (which=="store") {
action="SSEFGS";
} else {
action="ISEFGS";
}
document.eventmaintenance. Action.val ue=action;
document.eventmaintenance. submit();
}
}
}
</script>
I don't control <a>, I just retrieve the HTML code
Here is the editted version of the HTML code: (the link that I am talking about is in <FORM> called "Item group")
<HTML>
<HEAD><TITLE></TITLE>
</HEAD>
<BODY LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<script language="Javascript" src="/include/dropmenu.js"
<!-- BEGIN HEADER HTML -->
--CONTAINS THE LINKS THAT SHOWS UP IN IHTMLElementCollection
<!-- END HEADER HTML -->
<!--API Render Time End New Header: 78ms -->
<!--API Render Time: 94ms -->
<table height="100%" width="100%" cellpadding=0 cellspacing=0 border=0>
<tr>
<td valign="top" width="150" NOWRAP >
--CONTAINS LINKS THAT DO NOT SHOW IN IHTMLElementCollection
</td>
</tr>
<form name="eventmaintenance" action="/xxx/eventcalendar
<form name="eventmaintenance" action="/xxx/xxx/event_mai
<table width="100%" bgcolor='#ffffff' border="0">
<input type=Hidden name='Action'>
<input type=Hidden name='EventId' value="-1">
<input type=Hidden name='ParentId' value="">
<input type=Hidden name='CopyFromEventId' value="">
<input type=Hidden name='OldEventId' value="-1">
<input type=Hidden name='Level' value="">
<tr><td align="CENTER" valign="MIDDLE" class="subDark" bgcolor="#3366FF">Describe
<tr>
<td>
<table width="100%" border="0">
<tr>
<td class="sub">Name:</td>
<td><input type="Text" name="EventName" value="" maxlength="40" size="20"></td>
<td class="sub">Description</t
<td ><input type="Text" name="EventDesc" value="" maxlength="255" size="45"><br><font size=-3>(max of 255 characters)</font></td>
</tr>
</tr>
<tr>
<td class="sub">Event Category:</td>
<td>
<select name="EventCategory" onchange="refreshFromFormD
<option value="">--Choose--</optio
<option value="9">option1 </option>
<option value="13">option2 </option>
<option value="18">option3 </option>
<option value="27">option4 </option>
</select>
</td>
<td class="sub">Event<br>Type Code:</td>
<td>
<select name="EventTypeCode">
<option value="">--Choose--</optio
</select></td>
</tr>
</table>
</td></tr>
<tr><td align="CENTER" valign="MIDDLE" class="subDark" bgcolor="#3366FF">Time Occurrence</td></tr>
<tr><td>
<table width="100%" border="0">
<tr>
<td class="sub">Event Occurance:</td>
<td class="sub"><input type="radio" checked onClick="form.submit()" name="OccuranceType" value="-1">Once<input type="radio" onClick="form.submit()" name="OccuranceType" value="0">Annually</td>
<td></td><td></td></tr>
</table>
<table id="oncerows" width="100%" border="0">
<tr>
<td></td>
<td class="sub">Event<br>Begin
<td>
<SELECT name="BeginDateYYYY" onchange="changeSelectionD
<SELECT name="BeginDateMM" onchange="changeSelectionD
<SELECT name="BeginDateDD" onchange="changeSelectionD
<td></td></tr>
<tr>
<td class="sub"></td><td class="sub">Event<br>End Date:</td>
<td>
<SELECT name="EndDateYYYY" onchange="changeSelectionD
<SELECT name="EndDateMM" onchange="changeSelectionD
<SELECT name="EndDateDD" onchange="changeSelectionD
</td></tr>
<tr>
<td nowrap class="normal"><input size="9" name="mdseId" value="" type="text"><input name="mdseDesc" size="30" type="text" value=""> <a class=bold href="javascript:chooseGro
<td></td>
</tr>
</table>
</form>
</td></tr></table></td></t
</body></html>
<SCRIPT LANGUAGE="JavaScript">
var bDecided = false;
var bSeries = true;
var bOccChange = false;
var bChild = eval("false");
var ParentID = "";
var parent_EventName = "";
var parent_EventStatus = "";
var parent_EventDesc = "";
var parent_EventTypeCode = "";
var parent_OwnerTypeCode = "";
var g_action;
var myTimeOut;
function refreshFromFormData() {
document.eventmaintenance.
document.eventmaintenance.
}
function open_popupCOE(value,EventI
{
var url = "/xxx/xxx/event_createCOE.
window.location = url;
}
function clearForm() {
document.eventmaintenance.
document.eventmaintenance.
document.eventmaintenance.
}
function bCreateNewEvent()
{
return (parent_EventStatus == "2" && document.eventmaintenance.
}
function areYouSure()
{
if(bCreateNewEvent())
if(confirm("By continuing, this action will create a new one time event. Are you sure you want to continue?"))
decided(false);
else
clearTimeOut();
else
decided(false);
}
function decided(bChoice)
{
bSeries = bChoice;
bDecided = true;
}
function checkStatus()
{
if(!bDecided){
myTimeOut = setTimeout("checkStatus()"
}
else{
if(!document.layers)
hide_modifyOccurrenceOrSer
clearTimeOut();
if(validateForm()){
if(bSeries){
g_action = "MODIFYSERIESOCCURRENCE";
if(bOccChange)
alert("Occurrence information can only be changed from the event that begins the series. All other changes will be applied to the series.");
}
else{
if(bCreateNewEvent()){
if(!bOccChange)
{
//lsirvin added this line to put the current EventId value into the OldEventId value.
document.eventmaintenance.
document.eventmaintenance.
}
g_action = "CREATEFROMOCCURRENCE";
}
}
document.eventmaintenance.
document.eventmaintenance.
}
}
}
function clearTimeOut()
{
clearTimeout(myTimeOut);
}
function submitForm(action) {
var bGood = false;
LEVEL = "";
switch(action){
case "CREATE":
bGood = (validateForm()) ? validateImpact() : false;
break;
case "MODIFYSERIES":
bGood = validateForm();
break;
case "ADDIMPACT":
bGood = validateImpact();
if (document.eventmaintenance
action = "ADDLEVEL";
document.eventmaintenance.
break;
case "ADDIMPACTSERIES":
bGood = validateImpact();
if (document.eventmaintenance
action = "ADDLEVELSERIES";
document.eventmaintenance.
break;
default:
bGood = true;
break;
}
if (bGood) {
document.eventmaintenance.
document.eventmaintenance.
document.eventmaintenance.
}
}
if(document.eventmaintenan
alert("The identifier field cannot be empty.");
bGood = false;
}
if(!isRealNumber(document.
alert("xxxx");
bGood = false;
}
return bGood;
}
function validateForm() {
var bGood = true;
//Check Describe Event
if (document.eventmaintenance
if (RTrim(document.eventmaint
if (RTrim(document.eventmaint
if (!bGood) { alert("Fill in all Event Description fields."); }
//Check Time Occurance
if (document.eventmaintenance
var begin = new Date(document.eventmainten
var end = new Date(document.eventmainten
if (end < begin) {
alert("Event End Date must be after Event Begin Date.");
bGood = false;
}
} else if (document.eventmaintenance
if (document.eventmaintenance
if (document.eventmaintenance
alert("Choose Exact Day Info.");
bGood=false;
}
} else if (document.eventmaintenance
if (document.eventmaintenance
alert("Choose Day of Week Info.");
bGood=false;
}
} else if (document.eventmaintenance
if (document.eventmaintenance
alert("Choose Holiday Info.");
bGood=false;
}
} else {
alert("Fill in Event Time Occurrance.");
bGood = false;
}
if (document.eventmaintenance
alert("Fill in Before/After Days fields.");
bGood = false;
}
if (document.eventmaintenance
alert("Fill in Remind Days.");
bGood = false;
}
if (!document.eventmaintenanc
alert("Select when event ends.");
bGood = false;
}
if (document.eventmaintenance
alert("Choose in how many years the Event will end.");
bGood = false;
}
document.eventmaintenance.
document.eventmaintenance.
document.eventmaintenance.
document.eventmaintenance.
if (!isRealNumber(document.ev
alert("Time Occurrance Fields must be whole numbers.");
bGood = false;
}
}
return bGood;
}
function clearLevelFields() {
document.eventmaintenance.
document.eventmaintenance.
document.eventmaintenance.
document.eventmaintenance.
document.eventmaintenance.
}
function makeSelectedIndexZero(fiel
eval("document.eventmainte
}
function chooseGroups(which,EventId
if (EventId!="-1") {
var url = "/xxx/xxx/" + which + "_group.asp?ch=H3&div=1&ap
//alert(url);
window.location = url;
} else { //Save event so they can choose item group for impact
if (validateForm()) {
var action;
if (which=="store") {
action="SSEFGS";
} else {
action="ISEFGS";
}
document.eventmaintenance.
document.eventmaintenance.
}
}
}
</script>
ASKER
There are t <form> tags, please ignore one of them, I made mistake during editting.
<a class=bold href="javascript:chooseGro ups('item' ,'-1')">It em group</a>
could you give this tag a "name" property/value?
like this:
<a name="lnkGroup" class=bold href="javascript:chooseGro ups('item' ,'-1')">It em group</a>
that would help a lot.
could you give this tag a "name" property/value?
like this:
<a name="lnkGroup" class=bold href="javascript:chooseGro
that would help a lot.
ASKER
wtconway,
I think something is wrong with the loop below, but I am not sure how to fix it.
========================== ========== ========== ========== ==========
IHTMLElementCollection eventLinks = myDoc.getElementsByTagName ("a");
int i = 0;
foreach (HTMLAnchorElementClass el in eventLinks)
{
i++;
Console.WriteLine(i.ToStri ng() + " : " + el.outerText);
if (el.outerText.Trim() == "Item Group")
{
el.click();
Task++;
break;
}
}
========================== ========== ========== ========== ==========
It finds 137 links proven by eventLinks.length = 137 , but i only goes to 49 and el.outerText for 49 is empty.
More details. There are 7 links (A,B,C,D,E,F,G) go horizontally across the top of the webpage, if you hover on three of them (B,C,D), you will get a list of links that you can click. The rest of the links are somewhere in the page.
The loop only goes to the 7 links and and the links that are listed under B, which sums up to only 48 links.
Do you know what might have gone wrong?
Thanks for your help so far.
I think something is wrong with the loop below, but I am not sure how to fix it.
==========================
IHTMLElementCollection eventLinks = myDoc.getElementsByTagName
int i = 0;
foreach (HTMLAnchorElementClass el in eventLinks)
{
i++;
Console.WriteLine(i.ToStri
if (el.outerText.Trim() == "Item Group")
{
el.click();
Task++;
break;
}
}
==========================
It finds 137 links proven by eventLinks.length = 137 , but i only goes to 49 and el.outerText for 49 is empty.
More details. There are 7 links (A,B,C,D,E,F,G) go horizontally across the top of the webpage, if you hover on three of them (B,C,D), you will get a list of links that you can click. The rest of the links are somewhere in the page.
The loop only goes to the 7 links and and the links that are listed under B, which sums up to only 48 links.
Do you know what might have gone wrong?
Thanks for your help so far.
I ask again: can you name this link? Do you control the output of this page or does this page belong to someone else?
And I believe that should be
el.innerText.Trim() == "Item Group"
And I believe that should be
el.innerText.Trim() == "Item Group"
ASKER
Wtconway,
That page belongs to someone else.
I tried innerText, it outputs the same thing as outerText.
That page belongs to someone else.
I tried innerText, it outputs the same thing as outerText.
amuse me, try this:
el.innerText.Trim().ToLowe r == 'item group'
see if that works.
el.innerText.Trim().ToLowe
see if that works.
ASKER
Sorry,
still to no avail. :(
The only difference is in the console it outputs only to 48.
still to no avail. :(
The only difference is in the console it outputs only to 48.
can I have the url to the page? I want to try my own code against it...see if I can figure this out.
ASKER
I would like to, but I really can't since you need to login to get to the problematic page.
I think I will try to create a webpage that duplicate the original one.
The author of the page puts the each list of links for B,C,D in separate tables and the other links in different tables, and I think this causes the problem.
Let me recreate the page then.
ASKER
I tried to duplicate the code, but it won't work like the original page.
So, I editted the HTML code as little as I can and came up with this.
I stripped the javascript functions on the bottom except the ones that "item group" needs to function.
Other javascript functions that are invoked from href are written internally, because I don't see them anywhere in the source code.
Hope this is helpful for you to help me solving the problem
Thank you!
<meta http-equiv='content-type' content='text/html; charset=windows-1252'>
<HTML><HEAD><TITLE>Event </TITLE>
<STYLE>
.superDark{
font-family:arial;
font-size:8pt;
color:#FFFFFF;
text-decoration:none;
font-weight:bold;
}
.superDarkU{
font-family:arial;
font-size:8pt;
color:#FFFFFF;
font-weight:bold;
}
.myNormal{
font-family:arial;
font-size:8pt;
color:#000000;
}
.myBold{
font-family:arial;
font-size:8pt;
font-weight:bold;
color:#000000;
}
.myError{
font-family:arial;
font-size:10pt;
font-weight:bold;
color:Red;
}
.grid{border-width:.1em;bo rder-color :#a0a0a0;bord er-bottom- style:soli d;border-t op-style:n one;border -right-sty le:solid;b order-left -style:non e;}.gridlo wer{border -width:.1e m;border-c olor:#a0a0a0; border-bot tom-style: solid;bord er-top-sty le:none;bo rder-right -style:non e;border-l eft-style: none;}</ST YLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="/styles/site_styles. css">
<Script Language=JavaScript src="/include/common_clien t_scriptLi b.js"></SC RIPT>
<Script Language=JavaScript src="/xxxx/include/xxxx_co mmon.js">< /SCRIPT>
</HEAD>
<BODY LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<script language="Javascript" src="/include/dropmenu.js" ></script>
<!-- BEGIN HEADER HTML -->
<p id="TopRow0" style="border-right: thin solid #707070;" class="htrn">
<a class="htr" onmouseover="displayMenu(' 0'); hoverMenu(this);" href="/home/default.asp">M ain Link A </a></p>
<p id="TopRow1" style="border-right: thin solid #707070;" class="htrn">
<a class="htr" onmouseover="hoverMenu(thi s); displayxxMenu('1');" onmouseout="clearxxHeaderT imeout();" href="#">Main Link B </a></p>
<p id="TopRow2" style="border-right: thin solid #707070;" class="htrn">
<a class="htr" onmouseover="hoverMenu(thi s); displayxxMenu('2');" onmouseout="clearxxHeaderT imeout();" href="#">Main Link C </a></p>
<p id="TopRow3" style="border-right: thin solid #707070;" class="htrn">
<a class="htr" onmouseover="hoverMenu(thi s); displayxxMenu('3');" onmouseout="clearxxHeaderT imeout();" href="#">Main Link D </a></p>
<p id="TopRow4" style="border-right: thin solid #707070;" class="htrn">
<a class="htr" onmouseover="displayMenu(' 4'); hoverMenu(this);" href="/xxhome/site_map.asp x">Main Link E </a></p>
<p id="TopRow5" style="border-right: thin solid #707070;" class="htrn">
<a class="htr" onmouseover="displayMenu(' 5'); hoverMenu(this);" href="/custom/personalize. asp">Main Link F </a></p>
<p id="TopRow6" class="htrn">
<a class="htr" onmouseover="displayMenu(' 6'); hoverMenu(this);" href="/xx_security/xx_logo ff.aspx?lo goff=Y">Ma in Link G </a></p>
<script language="javascript"> arrange(); </script>
<div id="theDiv" class="menuMain">
<table id="MenuB" bgColor="#E0E0E0" style="display:none;">
<tr><td><a href="PageA.aspx" class="hmi">PageA</a></td> </tr>
<tr><td><a href="PageB.aspx" class="hmi">PageB</a></td> </tr>
<tr><td><a href="PageC.aspx" class="hmi">PageC</a></td> </tr>
<tr><td style="border-top: thin outset white" width=100%>
<table>
<tr>
<td>
<a href="javascript:openWinNo URL('/home /site_map. aspx?custo m=Y&selkey =H200','si teMap',600 ,500)"></a >
</td>
<td valign="middle">
<a style="font-weight: bold;" class="hmi" href="javascript:openWinNo URL('/home /site_map. aspx?custo m=Y&selkey =H200','si teMap',600 ,500)">&nb sp;Add/Rem ove</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table id="MenuC" bgColor="#E0E0E0" style="display:none;">
<tr><td><a href="PageA.aspx" class="hmi">PageA</a></td> </tr>
<tr><td><a href="PageB.aspx" class="hmi">PageB</a></td> </tr>
<tr><td><a href="PageC.aspx" class="hmi">PageC</a></td> </tr>
<tr><td style="border-top: thin outset white" width=100%>
<table>
<tr>
<td>
<a href="javascript:openWinNo URL('/home /site_map. aspx?custo m=Y&selkey =H201','si teMap',600 ,500)"></a >
</td>
<td valign="middle">
<a style="font-weight: bold;" class="hmi" href="javascript:openWinNo URL('/home /site_map. aspx?custo m=Y&selkey =H201','si teMap',600 ,500)">&nb sp;Add/Rem ove</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table id="MenuD" bgColor="#E0E0E0" style="display:none;">
<tr><td><a href="PageA.aspx" class="hmi">PageA</a></td> </tr>
<tr><td><a href="PageB.aspx" class="hmi">PageB</a></td> </tr>
<tr><td><a href="PageC.aspx" class="hmi">PageC</a></td> </tr>
<tr><td style="border-top: thin outset white" width=100%>
<table>
<tr>
<td>
<a href="javascript:openWinNo URL('/home /site_map. aspx?custo m=Y&selkey =H204','si teMap',600 ,500)"></a >
</td>
<td valign="middle">
<a style="font-weight: bold;" class="hmi" href="javascript:openWinNo URL('/xxho me/site_ma p.aspx?cus tom=Y&selk ey=H204',' siteMap',6 00,500)">& nbsp;Add/R emove</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<iframe id="DivShim" src="javascript:false;" scrolling="no" frameborder="0" style="position:absolute; top:10px; left:10px; display:none; z-index: 0;"></iframe>
<table width="100%">
<tr>
<td valign="bottom" width="80%">
<table celpadding=0 cellspacing=0 width="100%">
<tr>
<td width=10% bgColor="navy" class="header10-s"> S earch:&nbs p;</td>
<td bgColor="navy" width="300px">
<input id="searchField" onKeyPress="return submitenter(this,event)" class="formfield" style="width:300px; border: none;"
</td>
<td width=50% bgColor=navy style="filter:alpha(opacit y=100, finishopacity=0, style=1, startx=0, starty=0, finishx=140, finishy=270"><input onclick="submitSearch();" type="button" class="formbutton9-p" value="GO">
</td>
</tr>
</table>
</td>
<td align="right"><a href="/default.asp?ch=home U2"></a>
</td>
</tr>
<tr>
<td>
<table width="100%">
<tr>
<td width="33%" class="header10-p">Irma's< /td>
<td class="header10-q"></td>
</tr>
</table>
</td>
<td class="header10-p" align="right">xx Week: <script language=javascript>displa yxxWeek(); </script>
</td>
</tr>
<tr>
<td></td>
</tr>
</table>
<div id="topper" onmouseover="DivSetVisible (false, document.getElementById('t heDiv'), 0);" style="position:absolute; top: 1; left:1; width:100%; height:1px;"></div>
<div id="RLmain" onmouseover="DivSetVisible (false, document.getElementById('t heDiv'), 0);" style="postition:block;">< script language=javascript>showLo go();</scr ipt>
<!-- END HEADER HTML -->
<table height="100%" width="100%" cellpadding=0 cellspacing=0 border=0>
<TR width="100%">\
<td valign="top" width="150">
<table border="0" height="100%" cellpadding="0" cellspacing="0" width="100%">
<tr>
<TD width="1" height="5" cellpadding="0" cellspacing="0" class="HomeTopMenuBackgrou nd"></td>
<td valign="top">
<table border="0" height="100%" cellpadding="0" cellspacing="0" width="100%">
<tr>
<script language="javascript" src="/home/xx_header.asp?u serid=xxx& language=E NG&flag=5& userkey=U2 ">
</script>
</tr>
<tr>
<td valign="top" width="150" NOWRAP >
<DIV class="normal"> </DIV >
<DIV class="lefthead">Collabora tion</DIV>
<DIV class="normal">   ; &nb sp;<A class="normal" HREF="/xxxx/notification/f cst_notifi cation.asp ?ch=H3&div =1&appType =xxxx">Not ification< /A></DIV>
<DIV class="normal">   ; &nb sp;<A class="normal" HREF="/xxxx/itemselection/ item_searc h.asp?ch=H 3&div=1">I tem Selection</A></DIV>
</td>
</tr>
<tr>
<td>
<form name="eventmaintenance" action="/xxxx/xxx/event_ma intenance. asp?ch=H3& div=1&appT ype=xxxx" method="POST">
<table width="100%" bgcolor='#ffffff' border="0">
<input type=Hidden name='Action'>
<input type=Hidden name='EventId' value="-1">
<input type=Hidden name='ParentId' value="">
<input type=Hidden name='CopyFromEventId' value="">
<input type=Hidden name='OldEventId' value="-1">
<input type=Hidden name='Level' value="">
<input type=Hidden name='OwnerId' value="xxx">
<tr>
<td align="CENTER" valign="MIDDLE" class="subDark" bgcolor="#3366FF">Describe Event</td>
</tr>
<tr>
<td>
<table width="100%" border="0">
<tr>
<td class="sub">Name:</td>
<td><input type="Text" name="EventName" value="" maxlength="40" size="20"></td>
<td class="sub">Description</t d>
<td ><input type="Text" name="EventDesc" value="" maxlength="255" size="45"><br><font size=-3>(max of 255 characters)</font></td>
</tr>
<tr>
<td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="sub"></td>
<input size="9" name="mdseId" value="" type="text">
<input name="mdseDesc" size="30" type="text" value="">
<a class=bold href="javascript:chooseGro ups('item' ,'-1')">It em Group</a>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language="javascript" src="/home/xx_footer.asp?l anguage=EN G&country= US"></scri pt>
</body>
</html>
<SCRIPT LANGUAGE="JavaScript">
function chooseGroups(which,EventId ) {
if (EventId!="-1") {
var url = "/xxx/xxx/" + which + "_group.asp?ch=H3&div=1&ap pType=xxx& EventId=-1 &mdseLevel =" + document.eventmaintenance. mdseLevel. value + "&mdseId=" + document.eventmaintenance. mdseId.val ue + "&buId=&xxxmdseId=&xxxbuId =";
//alert(url);
window.location = url;
} else { //Save event so they can choose item group for impact
if (validateForm()) {
var action;
if (which=="store") {
action="SSEFGS";
} else {
action="ISEFGS";
}
document.eventmaintenance. Action.val ue=action;
document.eventmaintenance. submit();
}
}
}
function validateForm() {
var bGood = true;
//Check Describe Event
if (document.eventmaintenance .EventType Code.optio ns[documen t.eventmai ntenance.E ventTypeCo de.selecte dIndex].va lue=="") { bGood=false; }
if (RTrim(document.eventmaint enance.Eve ntDesc.val ue)=="") { bGood=false; }
if (RTrim(document.eventmaint enance.Eve ntName.val ue)=="") { bGood=false; }
if (!bGood) { alert("Fill in all Event Description fields."); }
//Check Time Occurance
if (document.eventmaintenance .Occurance Type[0].ch ecked) { //Once
var begin = new Date(document.eventmainten ance.Begin DateMM.opt ions[docum ent.eventm aintenance .BeginDate MM.selecte dIndex].va lue + "/" + document.eventmaintenance. BeginDateD D.options[ document.e ventmainte nance.Begi nDateDD.se lectedInde x].value + "/" + document.eventmaintenance. BeginDateY YYY.option s[document .eventmain tenance.Be ginDateYYY Y.selected Index].val ue);
var end = new Date(document.eventmainten ance.EndDa teMM.optio ns[documen t.eventmai ntenance.E ndDateMM.s electedInd ex].value + "/" + document.eventmaintenance. EndDateDD. options[do cument.eve ntmaintena nce.EndDat eDD.select edIndex].v alue + "/" + document.eventmaintenance. EndDateYYY Y.options[ document.e ventmainte nance.EndD ateYYYY.se lectedInde x].value);
if (end < begin) {
alert("Event End Date must be after Event Begin Date.");
bGood = false;
}
} else if (document.eventmaintenance .Occurance Type[1].ch ecked) { //Annual
if (document.eventmaintenance .AnnuallyT ype[0].che cked) { //Exact Day
if (document.eventmaintenance .SpecificD ateMonth.o ptions[doc ument.even tmaintenan ce.Specifi cDateMonth .selectedI ndex].valu e=="-1" || document.eventmaintenance. SpecificDa teDay.opti ons[docume nt.eventma intenance. SpecificDa teDay.sele ctedIndex] .value=="- 1") {
alert("Choose Exact Day Info.");
bGood=false;
}
} else if (document.eventmaintenance .AnnuallyT ype[1].che cked) { //Day of Week
if (document.eventmaintenance .DayWhichW eek.option s[document .eventmain tenance.Da yWhichWeek .selectedI ndex].valu e=="-1" || document.eventmaintenance. DayWhichDa y.options[ document.e ventmainte nance.DayW hichDay.se lectedInde x].value== "-1" || document.eventmaintenance. DayWhichMo nth.option s[document .eventmain tenance.Da yWhichMont h.selected Index].val ue=="-1") {
alert("Choose Day of Week Info.");
bGood=false;
}
} else if (document.eventmaintenance .AnnuallyT ype[2].che cked) { //Holiday
if (document.eventmaintenance .HolidayCo de.options [document. eventmaint enance.Hol idayCode.s electedInd ex].value= ="-1") {
alert("Choose Holiday Info.");
bGood=false;
}
} else {
alert("Fill in Event Time Occurrance.");
bGood = false;
}
if (document.eventmaintenance .DaysBefor eEvent.val ue==""||do cument.eve ntmaintena nce.DaysAf terEvent.v alue=="") {
alert("Fill in Before/After Days fields.");
bGood = false;
}
if (document.eventmaintenance .RemindDay s.value==" ") {
alert("Fill in Remind Days.");
bGood = false;
}
if (!document.eventmaintenanc e.EndCode[ 0].checked && !document.eventmaintenance .EndCode[1 ].checked) {
alert("Select when event ends.");
bGood = false;
}
if (document.eventmaintenance .EndCode[1 ].checked && document.eventmaintenance. Occurrance Count.valu e=="") {
alert("Choose in how many years the Event will end.");
bGood = false;
}
document.eventmaintenance. DaysBefore Event.valu e = document.eventmaintenance. DaysBefore Event.valu e.replace( ",","");
document.eventmaintenance. DaysAfterE vent.value = document.eventmaintenance. DaysAfterE vent.value .replace(" ,","");
document.eventmaintenance. RemindDays .value = document.eventmaintenance. RemindDays .value.rep lace(","," ");
document.eventmaintenance. Occurrance Count.valu e = document.eventmaintenance. Occurrance Count.valu e.replace( ",","");
if (!isRealNumber(document.ev entmainten ance.DaysB eforeEvent .value)||! isRealNumb er(documen t.eventmai ntenance.D aysAfterEv ent.value) ||!isRealN umber(docu ment.event maintenanc e.RemindDa ys.value)| |!isRealNu mber(docum ent.eventm aintenance .Occurranc eCount.val ue)) {
alert("Time Occurrance Fields must be whole numbers.");
bGood = false;
}
}
return bGood;
}
</script>
So, I editted the HTML code as little as I can and came up with this.
I stripped the javascript functions on the bottom except the ones that "item group" needs to function.
Other javascript functions that are invoked from href are written internally, because I don't see them anywhere in the source code.
Hope this is helpful for you to help me solving the problem
Thank you!
<meta http-equiv='content-type' content='text/html; charset=windows-1252'>
<HTML><HEAD><TITLE>Event </TITLE>
<STYLE>
.superDark{
font-family:arial;
font-size:8pt;
color:#FFFFFF;
text-decoration:none;
font-weight:bold;
}
.superDarkU{
font-family:arial;
font-size:8pt;
color:#FFFFFF;
font-weight:bold;
}
.myNormal{
font-family:arial;
font-size:8pt;
color:#000000;
}
.myBold{
font-family:arial;
font-size:8pt;
font-weight:bold;
color:#000000;
}
.myError{
font-family:arial;
font-size:10pt;
font-weight:bold;
color:Red;
}
.grid{border-width:.1em;bo
<LINK REL="stylesheet" TYPE="text/css" HREF="/styles/site_styles.
<Script Language=JavaScript src="/include/common_clien
<Script Language=JavaScript src="/xxxx/include/xxxx_co
</HEAD>
<BODY LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<script language="Javascript" src="/include/dropmenu.js"
<!-- BEGIN HEADER HTML -->
<p id="TopRow0" style="border-right: thin solid #707070;" class="htrn">
<a class="htr" onmouseover="displayMenu('
<p id="TopRow1" style="border-right: thin solid #707070;" class="htrn">
<a class="htr" onmouseover="hoverMenu(thi
<p id="TopRow2" style="border-right: thin solid #707070;" class="htrn">
<a class="htr" onmouseover="hoverMenu(thi
<p id="TopRow3" style="border-right: thin solid #707070;" class="htrn">
<a class="htr" onmouseover="hoverMenu(thi
<p id="TopRow4" style="border-right: thin solid #707070;" class="htrn">
<a class="htr" onmouseover="displayMenu('
<p id="TopRow5" style="border-right: thin solid #707070;" class="htrn">
<a class="htr" onmouseover="displayMenu('
<p id="TopRow6" class="htrn">
<a class="htr" onmouseover="displayMenu('
<script language="javascript"> arrange(); </script>
<div id="theDiv" class="menuMain">
<table id="MenuB" bgColor="#E0E0E0" style="display:none;">
<tr><td><a href="PageA.aspx" class="hmi">PageA</a></td>
<tr><td><a href="PageB.aspx" class="hmi">PageB</a></td>
<tr><td><a href="PageC.aspx" class="hmi">PageC</a></td>
<tr><td style="border-top: thin outset white" width=100%>
<table>
<tr>
<td>
<a href="javascript:openWinNo
</td>
<td valign="middle">
<a style="font-weight: bold;" class="hmi" href="javascript:openWinNo
</td>
</tr>
</table>
</td>
</tr>
</table>
<table id="MenuC" bgColor="#E0E0E0" style="display:none;">
<tr><td><a href="PageA.aspx" class="hmi">PageA</a></td>
<tr><td><a href="PageB.aspx" class="hmi">PageB</a></td>
<tr><td><a href="PageC.aspx" class="hmi">PageC</a></td>
<tr><td style="border-top: thin outset white" width=100%>
<table>
<tr>
<td>
<a href="javascript:openWinNo
</td>
<td valign="middle">
<a style="font-weight: bold;" class="hmi" href="javascript:openWinNo
</td>
</tr>
</table>
</td>
</tr>
</table>
<table id="MenuD" bgColor="#E0E0E0" style="display:none;">
<tr><td><a href="PageA.aspx" class="hmi">PageA</a></td>
<tr><td><a href="PageB.aspx" class="hmi">PageB</a></td>
<tr><td><a href="PageC.aspx" class="hmi">PageC</a></td>
<tr><td style="border-top: thin outset white" width=100%>
<table>
<tr>
<td>
<a href="javascript:openWinNo
</td>
<td valign="middle">
<a style="font-weight: bold;" class="hmi" href="javascript:openWinNo
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<iframe id="DivShim" src="javascript:false;" scrolling="no" frameborder="0" style="position:absolute; top:10px; left:10px; display:none; z-index: 0;"></iframe>
<table width="100%">
<tr>
<td valign="bottom" width="80%">
<table celpadding=0 cellspacing=0 width="100%">
<tr>
<td width=10% bgColor="navy" class="header10-s"> S
<td bgColor="navy" width="300px">
<input id="searchField" onKeyPress="return submitenter(this,event)" class="formfield" style="width:300px; border: none;"
</td>
<td width=50% bgColor=navy style="filter:alpha(opacit
</td>
</tr>
</table>
</td>
<td align="right"><a href="/default.asp?ch=home
</td>
</tr>
<tr>
<td>
<table width="100%">
<tr>
<td width="33%" class="header10-p">Irma's<
<td class="header10-q"></td>
</tr>
</table>
</td>
<td class="header10-p" align="right">xx Week: <script language=javascript>displa
</td>
</tr>
<tr>
<td></td>
</tr>
</table>
<div id="topper" onmouseover="DivSetVisible
<div id="RLmain" onmouseover="DivSetVisible
<!-- END HEADER HTML -->
<table height="100%" width="100%" cellpadding=0 cellspacing=0 border=0>
<TR width="100%">\
<td valign="top" width="150">
<table border="0" height="100%" cellpadding="0" cellspacing="0" width="100%">
<tr>
<TD width="1" height="5" cellpadding="0" cellspacing="0" class="HomeTopMenuBackgrou
<td valign="top">
<table border="0" height="100%" cellpadding="0" cellspacing="0" width="100%">
<tr>
<script language="javascript" src="/home/xx_header.asp?u
</script>
</tr>
<tr>
<td valign="top" width="150" NOWRAP >
<DIV class="normal"> </DIV
<DIV class="lefthead">Collabora
<DIV class="normal">  
<DIV class="normal">  
</td>
</tr>
<tr>
<td>
<form name="eventmaintenance" action="/xxxx/xxx/event_ma
<table width="100%" bgcolor='#ffffff' border="0">
<input type=Hidden name='Action'>
<input type=Hidden name='EventId' value="-1">
<input type=Hidden name='ParentId' value="">
<input type=Hidden name='CopyFromEventId' value="">
<input type=Hidden name='OldEventId' value="-1">
<input type=Hidden name='Level' value="">
<input type=Hidden name='OwnerId' value="xxx">
<tr>
<td align="CENTER" valign="MIDDLE" class="subDark" bgcolor="#3366FF">Describe
</tr>
<tr>
<td>
<table width="100%" border="0">
<tr>
<td class="sub">Name:</td>
<td><input type="Text" name="EventName" value="" maxlength="40" size="20"></td>
<td class="sub">Description</t
<td ><input type="Text" name="EventDesc" value="" maxlength="255" size="45"><br><font size=-3>(max of 255 characters)</font></td>
</tr>
<tr>
<td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="sub"></td>
<input size="9" name="mdseId" value="" type="text">
<input name="mdseDesc" size="30" type="text" value="">
<a class=bold href="javascript:chooseGro
<td></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language="javascript" src="/home/xx_footer.asp?l
</body>
</html>
<SCRIPT LANGUAGE="JavaScript">
function chooseGroups(which,EventId
if (EventId!="-1") {
var url = "/xxx/xxx/" + which + "_group.asp?ch=H3&div=1&ap
//alert(url);
window.location = url;
} else { //Save event so they can choose item group for impact
if (validateForm()) {
var action;
if (which=="store") {
action="SSEFGS";
} else {
action="ISEFGS";
}
document.eventmaintenance.
document.eventmaintenance.
}
}
}
function validateForm() {
var bGood = true;
//Check Describe Event
if (document.eventmaintenance
if (RTrim(document.eventmaint
if (RTrim(document.eventmaint
if (!bGood) { alert("Fill in all Event Description fields."); }
//Check Time Occurance
if (document.eventmaintenance
var begin = new Date(document.eventmainten
var end = new Date(document.eventmainten
if (end < begin) {
alert("Event End Date must be after Event Begin Date.");
bGood = false;
}
} else if (document.eventmaintenance
if (document.eventmaintenance
if (document.eventmaintenance
alert("Choose Exact Day Info.");
bGood=false;
}
} else if (document.eventmaintenance
if (document.eventmaintenance
alert("Choose Day of Week Info.");
bGood=false;
}
} else if (document.eventmaintenance
if (document.eventmaintenance
alert("Choose Holiday Info.");
bGood=false;
}
} else {
alert("Fill in Event Time Occurrance.");
bGood = false;
}
if (document.eventmaintenance
alert("Fill in Before/After Days fields.");
bGood = false;
}
if (document.eventmaintenance
alert("Fill in Remind Days.");
bGood = false;
}
if (!document.eventmaintenanc
alert("Select when event ends.");
bGood = false;
}
if (document.eventmaintenance
alert("Choose in how many years the Event will end.");
bGood = false;
}
document.eventmaintenance.
document.eventmaintenance.
document.eventmaintenance.
document.eventmaintenance.
if (!isRealNumber(document.ev
alert("Time Occurrance Fields must be whole numbers.");
bGood = false;
}
}
return bGood;
}
</script>
It doesn't look like I can reproduce the page...i don't have copies of CSS and Javascript files you guys are referencing. I'm pretty sure that the dynamically added links and such are causing the problem, however.
Which link is it that will cause the other links to appear? And it is one of these appearing links you want to click?
Which link is it that will cause the other links to appear? And it is one of these appearing links you want to click?
ASKER
Wtconway,
The link that I want to click is already on the page and it is on the HTML that I posted above. It looks like this:
<a class=bold href="javascript:chooseGro ups('item' ,'-1')">It em Group</a>
Since this webpage is not mine, I don't have the copies of CSS and javascript files either. :(
The link that I want to click is already on the page and it is on the HTML that I posted above. It looks like this:
<a class=bold href="javascript:chooseGro
Since this webpage is not mine, I don't have the copies of CSS and javascript files either. :(
ASKER
Wtconway,
I found the root of the problem...
the 49th link is an image, thus I can't use innertext or outertext to use in comparison...
When I tried link.href as you recommended, there are some codes that still uses outerText. That's why it failed....
So using .href is safer than innerText or outerText.
Thank you for the help....
I found the root of the problem...
the 49th link is an image, thus I can't use innertext or outertext to use in comparison...
When I tried link.href as you recommended, there are some codes that still uses outerText. That's why it failed....
So using .href is safer than innerText or outerText.
Thank you for the help....
No problem...well at least you know how to do it now.