Enjoy an ad free experience by logging in. Not a member yet?
Register .
05-05-2011, 12:20 PM
PM User |
#1
New to the CF scene
Join Date: May 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
below code is not working in windows7 ie8, but working fine in xp ie8. Please help me
below code is not working in windows7 ie8, but working fine in xp ie8
Code:
import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.PrintStream;
import netscape.javascript.JSObject;
public class htmlMenu extends Applet
implements ActionListener
{
public void init()
{
try
{
winLocal = JSObject.getWindow(this);
}
catch(Exception _ex)
{
System.out.println("Error: Applet cannot get window name. \nThis error will throw unhandled exceptions.\nMake sure you have the MAYSCRIPT attribute in your object or applet tag!");
}
paramItemCap_ = getParameter("itemcap");
paramDisableList_ = getParameter("disable");
paramCommonFunction_ = getParameter("commonfunction");
boolMenuEnabled = true;
if(paramItemCap_ != null && paramItemCap_ != "")
intItemCap = Integer.parseInt(paramItemCap_) + 1;
mnuMain = new PopupMenu();
mnuSub = new Menu[intItemCap];
mnuItem = new MenuItem[intItemCap];
strAryFunctions = new String[intItemCap];
if(!getNextParam(1))
{
intItemCap = 0;
intLenDisableList = 0;
}
for(x = 1; x < intItemCap; x++)
{
intMaxItemID = x;
intMenuParentID = Integer.parseInt(strMenuData.substring(0, intDLoc1));
strMenuLabel = strMenuData.substring(intDLoc1 + 1, intDLoc2);
strMenuFunction = strMenuData.substring(intDLoc2 + 1);
if(strMenuFunction.length() < 1)
strMenuFunction = paramCommonFunction_;
if(strMenuLabel.equals("-"))
buildSeparator(intMenuParentID);
else
if(strMenuFunction.equals("none") || strMenuFunction.equals("submenu"))
{
mnuSub[x] = new Menu(strMenuLabel);
mnuSub[x].addActionListener(this);
if(intMenuParentID == 0)
mnuMain.add(mnuSub[x]);
else
mnuSub[intMenuParentID].add(mnuSub[x]);
} else
if(strMenuFunction.equals("url"))
{
menuURL = getParameter("url" + x);
dlLoc = menuURL.indexOf("|");
if(dlLoc != -1)
{
strTemp = menuURL.substring(dlLoc + 1);
menuURL = menuURL.substring(0, dlLoc);
if(strTemp.equals("_top"))
{
strPre = "top.location.href='";
strPost = "';";
} else
if(strTemp.equals("_new"))
{
strPre = "window.open('";
strPost = "','NewWindow');";
} else
{
strPre = "top." + strTemp + ".location.href='";
strPost = "';";
}
} else
{
strPre = "location.href=";
strPost = "';";
}
strAryFunctions[x] = strMenuFunction;
mnuItem[x] = new MenuItem(strMenuLabel);
mnuItem[x].setActionCommand(strPre + menuURL + strPost);
if(intMenuParentID == 0)
mnuMain.add(mnuItem[x]);
else
mnuSub[intMenuParentID].add(mnuItem[x]);
} else
{
strAryFunctions[x] = strMenuFunction;
mnuItem[x] = new MenuItem(strMenuLabel);
mnuItem[x].setActionCommand(strMenuFunction);
if(intMenuParentID == 0)
mnuMain.add(mnuItem[x]);
else
mnuSub[intMenuParentID].add(mnuItem[x]);
}
if(!getNextParam(x + 1))
x = intItemCap;
}
add(mnuMain);
mnuMain.addActionListener(this);
if(paramDisableList_ != null && paramDisableList_.length() > 0)
{
paramDisableList_ += ",";
strItemID = "0";
intLenDisableList = paramDisableList_.length();
for(x = 0; x <= intLenDisableList - 1; x++)
{
intChar = paramDisableList_.charAt(x);
if(intChar != 44)
strItemID += (char)intChar;
else
try
{
intItemID = Integer.parseInt(strItemID);
if(intItemID <= intMaxItemID)
setItemEnabled(intItemID, false);
strItemID = "0";
}
catch(NumberFormatException _ex)
{
strItemID = strItemID;
getAppletContext().showStatus("Invalid Disable Parameter");
}
}
}
}
private void setItemEnabled(int intItemID_, boolean boolEnabled_)
{
mnuItem[intItemID_].setEnabled(boolEnabled_);
}
private void buildSeparator(int parentID_)
{
if(parentID_ == 0)
mnuMain.addSeparator();
else
mnuSub[menuItemParent].addSeparator();
}
private boolean getNextParam(int x_)
{
strMenuData = getParameter("item" + x_);
if(strMenuData == null)
return false;
intDLoc1 = strMenuData.indexOf("|");
if(intDLoc1 == -1)
return false;
intDLoc2 = strMenuData.lastIndexOf("|");
if(intDLoc2 == intDLoc1)
{
strMenuData += "|";
intDLoc2 = strMenuData.length() - 1;
}
return true;
}
public String getAppletInfo()
{
return "htmlMenu Java Applet\nComputer Task Group, Inc.\nCopyright 1999";
}
public void setMenuEnabled(boolean state_)
{
boolMenuEnabled = state_;
}
public void actionPerformed(ActionEvent e_)
{
String strCommand = e_.getActionCommand();
String strArguments[] = {
strCommand
};
if(strCommand == null || strCommand.length() < 1)
try
{
winLocal.eval("alert('The page author has failed to supply an appropriate action for this menu item')");
}
catch(Exception _ex)
{
getAppletContext().showStatus("Error accessing function or window");
}
else
winLocal.eval(strCommand);
}
public void showMenu(int intX_, int intY_)
{
if(boolMenuEnabled)
mnuMain.show(this, intX_, intY_);
}
public htmlMenu()
{
intItemCap = 100;
}
JSObject winLocal;
PopupMenu mnuMain;
MenuItem mnuItem[];
Menu mnuSub[];
int intItemID;
int intMaxItemID;
int intMenuParentID;
int intLenDisableList;
int intDLoc1;
int dlLoc;
int intDLoc2;
int menuItemParent;
int intItemCap;
int intChosenItem;
int intChar;
int x;
boolean boolMenuEnabled;
String menuURL;
String strTemp;
String strPre;
String strPost;
String strAryFunctions[];
String strMenuLabel;
String strMenuFunction;
String strMenuData;
String strItemID;
String paramDisableList_;
String paramItemCap_;
String paramCommonFunction_;
}
Last edited by WA; 08-15-2011 at 08:15 AM ..
05-06-2011, 01:18 AM
PM User |
#2
Regular Coder
Join Date: May 2006
Location: Ontario, Canada
Posts: 392
Thanks: 2
Thanked 20 Times in 20 Posts
What part isn't working?
05-06-2011, 10:04 AM
PM User |
#3
New to the CF scene
Join Date: May 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
action lister is not working
07-30-2011, 08:12 PM
PM User |
#4
New Coder
Join Date: Jul 2011
Location: Berkeley, CA
Posts: 20
Thanks: 2
Thanked 2 Times in 1 Post
Fixed. PM sent.
If you have any other questions mate let me know.
Action lister needed minor adjustment.
The Following 2 Users Say Thank You to AndrewCollins For This Useful Post:
08-10-2011, 08:45 PM
PM User |
#5
New Coder
Join Date: Jul 2011
Location: Berkeley, CA
Posts: 20
Thanks: 2
Thanked 2 Times in 1 Post
Quote:
Originally Posted by
AndrewCollins
Fixed. PM sent.
If you have any other questions mate let me know.
Action lister needed minor adjustment.
I have it finished I don't have your email please email it to me.
08-13-2011, 11:13 AM
PM User |
#6
New to the CF scene
Join Date: Aug 2011
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
Quote:
Originally Posted by
AndrewCollins
Fixed. PM sent.
If you have any other questions mate let me know.
Action lister needed minor adjustment.
why don't you also share the solution here on this thread, so everyone can benefit?
Thanks!
08-13-2011, 11:15 AM
PM User |
#7
New Coder
Join Date: Aug 2011
Location: Brisbane, AUS
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
I agree, it would be nice if a solution could be shared.
08-13-2011, 04:44 PM
PM User |
#8
New to the CF scene
Join Date: Aug 2011
Location: Florida, USA
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by
AndrewCollins
Fixed. PM sent.
If you have any other questions mate let me know.
Action lister needed minor adjustment.
Andrew,
Will your solution work in 64-bit versions of IE? Also, will your solution behave in IE9? Would you mind posting your solution here?
Thanks.
08-13-2011, 06:09 PM
PM User |
#9
New to the CF scene
Join Date: Aug 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by
AndrewCollins
I have it finished I don't have your email please email it to me.
Anderw, please PM code to me as well.
Thanks.
08-14-2011, 07:39 AM
PM User |
#10
New Coder
Join Date: Aug 2011
Location: I live in Sydney, Australia but travel a lot for business
Posts: 14
Thanks: 0
Thanked 2 Times in 2 Posts
Hi folks, +1 for sharing your solution with the thread Andrew - if its not too much hassle anyways...
Also interested to know if anyone has worked out whether merely upgrading to IE9 will solve the problems, it seems like the path of least resistance
08-14-2011, 08:40 AM
PM User |
#11
New to the CF scene
Join Date: Aug 2011
Posts: 9
Thanks: 0
Thanked 1 Time in 1 Post
Andrew, I'd also be interested in the solution for this. I've had a look through with some friends of mine, and none of us can work out why it works in IE on XP but not Win7 - sometimes I really do think IE has a mind of its own.
08-15-2011, 01:25 AM
PM User |
#12
New to the CF scene
Join Date: Aug 2011
Location: Philippines
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
I am also having this problem. It would be great if Andrew could share it on this thread or pm us for the solution. Have been looking to fix this for some time now.
08-15-2011, 01:38 AM
PM User |
#13
New to the CF scene
Join Date: Aug 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
I would like that sent to me as well
08-15-2011, 08:45 PM
PM User |
#14
New to the CF scene
Join Date: Feb 2009
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
Could you PM me the solution? I'm having the same problem with some Java in xp ie8 as well. Thanks!
08-16-2011, 03:14 AM
PM User |
#15
New Coder
Join Date: Aug 2011
Location: Virginia
Posts: 10
Thanks: 2
Thanked 1 Time in 1 Post
Please send details as well.
Poll: Who doesn't like windows?
Answer: Me, Me, Me
Thanks in advance.
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 01:48 PM .
Advertisement
Log in to turn off these ads.