Link to home
Start Free TrialLog in
Avatar of ZafarAbid
ZafarAbid

asked on

JavaScript Onload Code

Hi,
I am using ASP for a page, where I load a list of videos from db... listing of videos and when you click them, they play properly but the first video does not load automatically... I want to load the first video from db when the page loads in the browser for the first time.

I have pasted the code below, I hope this helps you understand my question.

Regards,
Zafar
Code Chunk 1:
////////////////////////
<li style="margin-right:0px; padding-right:0px; margin-bottom:0px; padding-bottom:0px; "  >
 
<A id="vlist<%=cnt%>" HREF="#" STYLE="text-decoration:none; padding-right:0px; margin-right:0px;  " onclick='javascript:new_video(s1,"<%=vid_url%>","<%=RS2("VIDEO_TITLE")%>","<%=RS2("VIDEO_DESCRIPTION")%>",<%=cnt%>)' onMouseOver="this.style.cursor='hand';vidOn(<%=cnt%>);" onmouseout="vidOff(<%=cnt%>);" ><%=RS2("VIDEO_TITLE")%>
</A>
</li>
///////////////////////////////////
 
The function: Code Chunk 2:
///////////////////////////////////
function new_video(s1,vid_name,vid_title,vid_des,vlist) {
	s1.addVariable("FlashVars","&bgColor=0xFFFFFF&serverName=NAME_OF_THE_SERVER" + vid_name);
	s1.write("player1");
 
    if (crtList != 0) {
    	document.getElementById("vlist" + crtList).style.backgroundColor = "#E2E2E2";
    }
    crtList = vlist;
    if (crtList != 0) {
    	document.getElementById("vlist" + crtList).style.backgroundColor = "#D4D4D4";
    }
}
///////////////////////////////////

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of -null-
-null-

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ZafarAbid
ZafarAbid

ASKER

I totally agree with your solution and it worked as well... one more concern is that the body tag is at the top and the SQL query and db opening is in an include file...

Do you suggest moving all that code at the top? or how should I deal with this situation?

Regards,
Zafar
Thank you. :)
You can treat the sql and db code as being seperate to the body of the document. You shouldn't have to move it.

null