Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

onload

 
Jherald Lacambra
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a function in javascript that was called onload of the web page.. but it doesn't work, i tried to put alerts on it but the onload function of the html seems to be not working.. anybody can help me with this?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
code?
 
Jherald Lacambra
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have problem posting my code code in here.. i replace my code with the specified characters that you want but it seems that im still in trouble... my code is 923 lines in my ide.. but i cant post it in here.. is there any other way for you to see my codes?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do yourself a favor, get Mozilla or Firefox and look at the JavaScript Console and look for an error message.

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my code is 923 lines in my ide..


Your onload function is 923 lines?
[ July 26, 2005: Message edited by: Bear Bibeault ]
 
Jherald Lacambra
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have netscape 7.1 for javascript debugging.. actually it is a small dynamic page(JSP) so it has 923 lines of code.. a simple function that is being called onload of the page was not called like putting alert to check whether the function is called or not.. netscape browser didn't detect errors so i can't figure out why its the onload function doesn't work
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have netscape 7.1 for javascript debugging.. actually it is a small dynamic page(JSP) so it has 923 lines of code.. a simple function that is being called onload of the page was not called like putting alert to check whether the function is called or not.. netscape browser didn't detect errors so i can't figure out why its the onload function doesn't work


If Nestcape doesn't detect errors, it's probably not suitable for JavaScript debugging. The Mozilla and Firefox browsers have a JavaScript console that will show errors. (I actually thought Netscape had that too, but maybe they removed it.)

If the problem is in JavaScript, then the JSP page itself doesn't matter; what does matter is what HTML/JavaScript code it produces. If you post a relevant excerpt of that, one might take a look and try to figure out what's going on.
 
Jherald Lacambra
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i cant post my code... I replace "<" with &1t but still i can't post same problem arises.. how can post my code in a different way?
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if there's an onclick property on one of your elements, replace it with "on click" or even "on&#99;click". Similar for whatever else is being complained about.

-Yuriy
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But please do not post all 923 lines of your page. Rather, take the time to pare it down to what is relevant.
 
Jherald Lacambra
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
&1t;tr bgcolor="#BFBFBF">
&1t;td colspan="7">&1t;div align="left" class="style31">Page &1t;%=page1%> of &1t;%=totPage%>&1t;/div>
&1t;span class="style31">
&1t;!--select name="paging" on change="selectPage();">
&1t;/select-->
&1t;/span>&1t;/td>
&1t;td colspan="2">&1t;div align="right" class="style31">
&1t;%
System.out.println("pagesa[0]: "+pagesa[0]);
System.out.println("pagesb[0]: "+pagesb[0]);
System.out.println("pagesc[0]: "+pagesc[0]);
%>
&1t;script language="javascript">
var pagesa1 = &1t;%out.println(pagesa[0]);%>;
var pagesa2 = &1t;%out.println(pagesa[0]);%>;
var pagesa3 = &1t;%out.println(pagesb[0]);%>;
var pagesa4 = &1t;%out.println(pagesc[0]);%>;

var pagesa = new Array(
&1t;%out.println(pagesa[0]);
for(int p=1;p&1t;totPage;p++){out.println(", "+pagesa[p]);}
%>

var pagesb = new Array(
&1t;%out.println(pagesb[0]);
for(int p=1;p&1t;totPage;p++){out.println(", "+pagesb[p]);}
%>

var pagesc = new Array(
&1t;%out.println(pagesc[0]);
for(int p=1;p&1t;totPage;p++){out.println(", "+pagesc[p]);}
%>

var pagesArray1 = new Array(
&1t;%out.println(page1);
out.println(", "+page2);
out.println(", "+page3);
out.println(", \""+page4+"\"");
out.println(", "+totPage);
out.println(", "+count);
out.println(", "+excess);
out.println(", \""+filters+"\"");
%>

//configure path for left and right arrows
var goleftimage='img/left1.gif'
var gorightimage='img/right1.gif'
//configure menu width (in px):
var menuwidth=100
//configure menu height (in px):
var menuheight=25
//Specify scroll buttons directions ("normal" or "reverse"):
var scrolldir="normal"
//configure scroll speed (1-10), where larger is faster
var scrollspeed=6
//specify menu content



var a="";
var x=0;

for(x=0;x&1t;pagesArray1[4];x++){

if(pagesArray1[4]>1){
if(x==(pagesArray1[4]-1)){
a=a+"&1t;span class=\"style30\">&1t;a href=\"updateR.jsp?page1="+pagesa[x]+"&page2="+pagesb[x]+"&page3="+pagesc[x]+"&filters=&1t;%=filters%>&userName=&1t;%=username%>\">"+pagesa[x]+"&1t;/a>&1t;/span>";
}else{
a=a+"&1t;span class=\"style30\">&1t;a href=\"updateR.jsp?page1="+pagesa[x]+"&page2="+pagesb[x]+"&page3="+pagesc[x]+"&filters=&1t;%=filters%>&userName=&1t;%=username%>\">"+pagesa[x]+"&1t;/a>&1t;/span>|";
}
}else{
a=a+"&1t;span class=\"style30\">&1t;a href=\"updateR.jsp?page1="+pagesa2+"&page2="+pagesa3+"&page3="+pagesa4+"&filters=&1t;%=filters%>&userName=&1t;%=username%>\">"+pagesa1+"&1t;/a>&1t;/span>";
}

}

var menucontents='&1t;nobr>&1t;span class="style31 style30">'+a+'&1t;/span>&1t;/nobr>';
/*////NO NEED TO EDIT BELOW THIS LINE////////////*/

var iedom=document.all||document.getElementById
var leftdircode='on Mouse over="moveright()" on Mouse out="clearTimeout(righttime)"'
var rightdircode='on Mouse over="moveleft()" on Mouse out="clearTimeout(lefttime)"'
if (scrolldir=="reverse"){
var tempswap=leftdircode
leftdircode=rightdircode
rightdircode=tempswap
}
if (iedom)
document.write('&1t;span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-5000">'+menucontents+'&1t;/span>')
var actualwidth=''
var cross_scroll, ns_scroll
var loadedyes=0
function fillup(){
if (iedom){
cross_scroll=document.getElementById? document.getElementById("test2") : document.all.test2
cross_scroll.innerHTML=menucontents
actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("temp").offsetWidth
}
else if (document.layers){
ns_scroll=document.ns_scrollmenu.document.ns_scrollmenu2
ns_scroll.document.write(menucontents)
ns_scroll.document.close()
actualwidth=ns_scroll.document.width
}
loadedyes=1
}
window.on load=fillup

function moveleft(){
if (loadedyes){
if (iedom&&parseInt(cross_scroll.style.left)>(menuwidth-actualwidth)){
cross_scroll.style.left=parseInt(cross_scroll.style.left)-scrollspeed+"px"
}
else if (document.layers&&ns_scroll.left>(menuwidth-actualwidth))
ns_scroll.left-=scrollspeed
}
lefttime=setTimeout("moveleft()",50)
}

function moveright(){
if (loadedyes){
if (iedom&&parseInt(cross_scroll.style.left)&1t;0)
cross_scroll.style.left=parseInt(cross_scroll.style.left)+scrollspeed+"px"
else if (document.layers&&ns_scroll.left&1t;0)
ns_scroll.left+=scrollspeed
}
righttime=setTimeout("moveright()",50)
}


if (iedom||document.layers){
with (document){
write('&1t;table border="0" cellspacing="0" cellpadding="2">')
write('&1t;td>&1t;a href="#" '+leftdircode+'>&1t;img src="'+goleftimage+'"border=0>&1t;/a> &1t;/td>')
write('&1t;td width="'+menuwidth+'px" valign="top">')
if (iedom){
write('&1t;div style="position:relative;width:'+menuwidth+'px;height:'+menuheight+'px;overflow:hidden;">')
write('&1t;div id="test2" style="position:absolute;left:0;top:0">')
write('&1t;/div>&1t;/div>')
}
else if (document.layers){
write('&1t;ilayer width='+menuwidth+' height='+menuheight+' name="ns_scrollmenu">')
write('&1t;layer name="ns_scrollmenu2" left=0 top=0>&1t;/layer>&1t;/ilayer>')
}
write('&1t;/td>')
write('&1t;td valign="top"> &1t;a href="#" '+rightdircode+'>')
write('&1t;img src="'+gorightimage+'"border=0>&1t;/a>')
write('&1t;/td>&1t;/table>')
}
}

&1t;/script>
&1t;/div>&1t;/td>
&1t;/tr>
 
Jherald Lacambra
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i remove that part of the code, the onload function in the body seems to be working.. what goes wrong with that code
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A few things.

1. When posting, replace &1t; with &lt;
2. When posting, use the CODE UBB option to preserve indentation
3. replace lines like this:



with lines like like this



Hopefully after that it will be easier to read.

-Yuriy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic