JS Error, ifId.location is null or not an object

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
jbreslow
Advanced
Advanced
Posts: 28
Joined: Mon Oct 14, 2002 10:04 pm

JS Error, ifId.location is null or not an object

Post by jbreslow »

I'm trying to get my menu to work with an iFrame, but I keep getting a JS error telling me that...

Error: 'idId.location' is Null or not an Object

What am I doing wrong? Below is my code.


<SCRIPT language=JavaScript src="milonic_src.js" type=text/javascript></SCRIPT>
<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=mmenudom.js><\/scr"+"ipt>");


function openIFrame(IFrameID, URL){
ifId=gmobj(IFrameID)
ifId.location.href=URL // Opera Bug Fix. ifId.src=URL
}
</script>
<SCRIPT language=JavaScript src="menu_data_forum.js" type=text/javascript>



<iframe name="calFrame" id="calFrame" src="http://www.google.com" frameborder="1" border="0" scrolling="auto" width="540" height="700">
<b>Your browser does not support iFrames</b>
</iframe>













// BEGIN: calendar menu for MS 1's
with(milonic=new menuname("calendarmainMS1")){
style=menuStyle;
overflow="scroll";
margin=2;
aI("text=Main;url=index.cfm?curpage=newcalendars&c=ms 1;");
aI("text=Core Course Calendar (default);showmenu=corecourseMS1;");
aI("text=Student Life Calendar;showmenu=studentlifeMS1;");
}

// BEGIN: core coure calendars for MS 1's
with(milonic=new menuname("corecourseMS1")){
style=menuStyle;
overflow="scroll";
margin=2;
aI("text=1 Open in Frame;url=javascript:openIFrame('calFrame,'http://ucsd.edu/command.shtml?'');image=images/same_window.gif;target=calFrame;");
aI("text=Open in New Window;url=http://ucsd.edu/command.shtml?;image=im ... arget=_new;");


// copied from milonic examples
aI("text=Open Google in IFrame;url=javascript:openIFrame('calFrame','http://www.google.com')");
aI("text=Apache Web Server;url=javascript:openIFrame('calFrame','http://www.apache.org/');;status=Apache Web Server, the basis of Milonic's Web Site;");
}
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

url=javascript:openIFrame('calFrame,'http://ucsd.edu/command.shtml?'');
Your quotes are all messed up here this should say

Code: Select all

url=javascript:openIFrame('calFrame','http://ucsd.edu/command.shtml?');
The calFrame should be surrounded by a single quote on either side, and same for the ucsd Url.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply