2x window.onload in 1 pagina, slechts 1 script werkt
Yazoo - 11/10/2011 16:00 (laatste wijziging 11/10/2011 16:30)
Lid
Hallo,
Ik heb om mijn pagina 2 javascripts waarin in beide window.onload wordt gebruikt. Een van de twee werkt. Ik ben een beginner en kom er niet uit, kan iemand het script aanpassen zodat ze beide werken? Ik zou heel blij zijn als iemand het kan oplossen, alvast bedankt voor de te nemen moeite!
(voor meer info: de website draait op megatunes.net)
Eerste script
Citaat:
<!--Begin sleepsysteem -->
<script language="JavaScript" type="text/javascript">
<!--
var dragsort = ToolMan.dragsort();
var junkdrawer = ToolMan.junkdrawer();
var rnd = Math.random();
window.onload = function() {
junkdrawer.restoreListOrder("boxes");
dragsort.makeListSortable(document.getElementById("boxes"),saveOrder);
}
function saveOrder(item) {
var group = item.toolManDragGroup;
var list = group.element.parentNode;
group.register('dragend', function() {
ToolMan.cookies().set("list-boxes",junkdrawer.serializeList(list), 150);
})
}
function restoreradio() {
var list = document.getElementById("boxes");
ToolMan.cookies().set("list-boxes",junkdrawer.serializeList(list), -150);
}
function radio(streamUrl) {
var zender = document.getElementById("player");
zender.innerHTML = '<object id="MediaPlayer" width="278" height="55" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" standby="MegaTunes.Net is loading..." type="application/x-oleobject"><param name="Filename" value="' + streamUrl + '"><param name="ShowControls" value="1"><param name="ShowDisplay" value="0"><param name="ShowStatusBar" value="1"><param name="AutoSize" value="0"><param name="Volume" value="1"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/" filename="' + streamUrl + '" src="' + streamUrl + '" name="MediaPlayer" showcontrols="0" volume="0" showdisplay="0" showstatusBar="0" width="250" height="60"></embed></object><br />';
}
//-->
</script><!--einde sleepsysteem -->
-----------------------------
Tweede script
Citaat:
<script type="text/javascript" src="http://www.bumpin.com/web_widget/users/swfobject.js"></script>
<script type="text/javascript" src="http://www.bumpin.com/web_widget/users/bar/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="http://www.bumpin.com/new_web_widget/widget.js"></script>
<script type="text/javascript" src="http://www.bumpin.com/new_web_widget/side_bar/bumpinSidechatWidget.js"></script>
<script>window.onload =function(){loadNewBumpinSideBarWidgetWithoutPeopleList({ height: "300", width: "200", language: "English", color_string: "", color_theme: "default", enable_login: "true", bumpin_policy: "domain", bumpin_url: "", widget_title: "Shoutbox", enable_guest_login: "true", show_people_list: "true", enable_sound: "true", nick_name: "" });}</script>
<div id="bumpin-sideBar"><a id="bumpin-sideBarTab" href="#"><div id="bumpin-count">1</div></a><div id="bumpin-sideBarContents"><div id="bumpin-sideBarContentsInner"><div id="bumpin-widget"></div></div></div><div id="bumpin-link-div"><a target="_blank" href="http://www.ticketmy.com/bumpin/index.php"><div class="flipv">Shoutbox</div></a></div></div>
..
10 antwoorden
Gesponsorde links
vinTage - 11/10/2011 16:04 (laatste wijziging 11/10/2011 16:06)
Nieuw lid
Plaats elke function die uitgevoerd moet worden in de onload zoals je gedeeltelijk al doet.
window.onload = function()
{
//script 1
junkdrawer.restoreListOrder("boxes");
//script 2
dragsort.makeListSortable(document.getElementById("boxes"),saveOrder);
//extra..
//script 3
loadNewBumpinSideBarWidgetWithoutPeopleList({ height: "300", width: "200", language: "English", color_string: "", color_theme: "default", enable_login: "true", bumpin_policy: "domain", bumpin_url: "", widget_title: "Shoutbox", enable_guest_login: "true", show_people_list: "true", enable_sound: "true", nick_name: "" });}
}
window.onload = function ( )
{
//script 1
junkdrawer.restoreListOrder ( "boxes" ) ;
//script 2
dragsort.makeListSortable ( document.getElementById ( "boxes" ) , saveOrder) ;
//extra..
//script 3
loadNewBumpinSideBarWidgetWithoutPeopleList( { height: "300" , width: "200" , language: "English" , color_string: "" , color_theme: "default" , enable_login: "true" , bumpin_policy: "domain" , bumpin_url: "" , widget_title: "Shoutbox" , enable_guest_login: "true" , show_people_list: "true" , enable_sound: "true" , nick_name: "" } ) ; }
}
De html die je in het 2e codeblok plaatst hoort niet bij de scripts, dit hoort gewoon bij je html.
Bedankt door: Yazoo
Yazoo - 11/10/2011 17:01 (laatste wijziging 11/10/2011 17:02)
Lid
Bedankt! Helaas werken beide scripts nu niet meer:
De scripts na de aanpassing:
Eerste script:
<!--Begin sleepsysteem -->
<script language="JavaScript" type="text/javascript">
<!--
var dragsort = ToolMan.dragsort();
var junkdrawer = ToolMan.junkdrawer();
var rnd = Math.random();
window.onload = function()
{
//script 1
junkdrawer.restoreListOrder("boxes");
//script 2
dragsort.makeListSortable(document.getElementById("boxes"),saveOrder);
//extra..
//script 3
loadNewBumpinSideBarWidgetWithoutPeopleList({ height: "300", width: "200", language: "English", color_string: "", color_theme: "default", enable_login: "true", bumpin_policy: "domain", bumpin_url: "", widget_title: "Shoutbox", enable_guest_login: "true", show_people_list: "true", enable_sound: "true", nick_name: "" });}
}
function saveOrder(item) {
var group = item.toolManDragGroup;
var list = group.element.parentNode;
group.register('dragend', function() {
ToolMan.cookies().set("list-boxes",junkdrawer.serializeList(list), 150);
})
}
function restoreradio() {
var list = document.getElementById("boxes");
ToolMan.cookies().set("list-boxes",junkdrawer.serializeList(list), -150);
}
function radio(streamUrl) {
var zender = document.getElementById("player");
zender.innerHTML = '<object id="MediaPlayer" width="278" height="55" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" standby="MegaTunes.Net is loading..." type="application/x-oleobject"><param name="Filename" value="' + streamUrl + '"><param name="ShowControls" value="1"><param name="ShowDisplay" value="0"><param name="ShowStatusBar" value="1"><param name="AutoSize" value="0"><param name="Volume" value="1"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/" filename="' + streamUrl + '" src="' + streamUrl + '" name="MediaPlayer" showcontrols="0" volume="0" showdisplay="0" showstatusBar="0" width="250" height="60"></embed></object><br />';
}
//-->
</script><!--einde sleepsysteem -->
<!-- Begin sleepsysteem -->
< script language= "JavaScript" type= "text/javascript" >
<!--
var dragsort = ToolMan.dragsort ( ) ;
var junkdrawer = ToolMan.junkdrawer ( ) ;
var rnd = Math.random ( ) ;
window.onload = function ( )
{
//script 1
junkdrawer.restoreListOrder ( "boxes" ) ;
//script 2
dragsort.makeListSortable ( document.getElementById ( "boxes" ) , saveOrder) ;
//extra..
//script 3
loadNewBumpinSideBarWidgetWithoutPeopleList( { height: "300" , width: "200" , language: "English" , color_string: "" , color_theme: "default" , enable_login: "true" , bumpin_policy: "domain" , bumpin_url: "" , widget_title: "Shoutbox" , enable_guest_login: "true" , show_people_list: "true" , enable_sound: "true" , nick_name: "" } ) ; }
}
function saveOrder( item ) {
var group = item .toolManDragGroup ;
var list = group.element .parentNode ;
group.register ( 'dragend' , function ( ) {
ToolMan.cookies ( ) .set ( "list-boxes" , junkdrawer.serializeList ( list) , 150 ) ;
} )
}
function restoreradio( ) {
var list = document.getElementById ( "boxes" ) ;
ToolMan.cookies ( ) .set ( "list-boxes" , junkdrawer.serializeList ( list) , - 150 ) ;
}
function radio( streamUrl) {
var zender = document.getElementById ( "player" ) ;
zender.innerHTML = '<object id="MediaPlayer" width="278" height="55" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" standby="MegaTunes.Net is loading..." type="application/x-oleobject"><param name="Filename" value="' + streamUrl + '"><param name="ShowControls" value="1"><param name="ShowDisplay" value="0"><param name="ShowStatusBar" value="1"><param name="AutoSize" value="0"><param name="Volume" value="1"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/" filename="' + streamUrl + '" src="' + streamUrl + '" name="MediaPlayer" showcontrols="0" volume="0" showdisplay="0" showstatusBar="0" width="250" height="60"></embed></object><br />' ;
}
//-->
</ script><!-- einde sleepsysteem -->
Tweede script, de onload heb ik weggehaald:
<script type="text/javascript" src="http://www.bumpin.com/web_widget/users/swfobject.js"></script>
<script type="text/javascript" src="http://www.bumpin.com/web_widget/users/bar/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="http://www.bumpin.com/new_web_widget/widget.js"></script><script type="text/javascript" src="http://www.bumpin.com/new_web_widget/side_bar/bumpinSidechatWidget.js"></script>
<div id="bumpin-sideBar"><a id="bumpin-sideBarTab" href="#"><div id="bumpin-count">1</div></a><div id="bumpin-sideBarContents"><div id="bumpin-sideBarContentsInner"><div id="bumpin-widget"></div></div></div><div id="bumpin-link-div"><a target="_blank" href="http://www.ticketmy.com/bumpin/index.php"><div class="flipv">Shoutbox</div></a></div></div>
< script type= "text/javascript" src= "http://www.bumpin.com/web_widget/users/swfobject.js" ></ script>
< script type= "text/javascript" src= "http://www.bumpin.com/web_widget/users/bar/jquery-1.3.2.min.js" ></ script>
< script type= "text/javascript" src= "http://www.bumpin.com/new_web_widget/widget.js" ></ script>< script type= "text/javascript" src= "http://www.bumpin.com/new_web_widget/side_bar/bumpinSidechatWidget.js" ></ script>
< div id= "bumpin-sideBar" >< a id= "bumpin-sideBarTab" href= "#" >< div id= "bumpin-count" > 1 </ div></ a>< div id= "bumpin-sideBarContents" >< div id= "bumpin-sideBarContentsInner" >< div id= "bumpin-widget" ></ div></ div></ div>< div id= "bumpin-link-div" >< a target= "_blank" href= "http://www.ticketmy.com/bumpin/index.php" >< div class = "flipv" > Shoutbox</ div></ a></ div></ div>
vinTage - 11/10/2011 17:07
Nieuw lid
maar saveorder/restoreradio/radio hoorden niet in de onload toch ..?
Bedankt door: Yazoo
Yazoo - 11/10/2011 17:16
Lid
Klopt die horen er niet bij, kun je mij aangeven hoe ik die er dan buiten moet houden?
Dank je!
vinTage - 11/10/2011 17:18
Nieuw lid
gewoon niet in de onload plaatsen...
<script>
//al je scripts hier (zonder de externe)
window.onload = function()
{
//wat in je onload moet
}
</script>
< script>
//al je scripts hier (zonder de externe)
window.onload = function ( )
{
//wat in je onload moet
}
</ script>
Bedankt door: Yazoo
Yazoo - 11/10/2011 18:28 (laatste wijziging 12/10/2011 20:50)
Lid
Ik heb het aangepast maar helaas lukt het me niet, ik heb te weinig kennis van Javascript...
Zou je zo vriendelijk willen zijn om de aanpassing in het script aan te brengen? Ik kan dan zelf zien wat ik fout doe omdat ik het gewoon niet weet.
Bedankt!
<!--Begin sleepsysteem -->
<script language="JavaScript" type="text/javascript">
<!--
var dragsort = ToolMan.dragsort();
var junkdrawer = ToolMan.junkdrawer();
var rnd = Math.random();
function saveOrder(item) {
var group = item.toolManDragGroup;
var list = group.element.parentNode;
group.register('dragend', function() {
ToolMan.cookies().set("list-boxes",junkdrawer.serializeList(list), 150);
})
}
function restoreradio() {
var list = document.getElementById("boxes");
ToolMan.cookies().set("list-boxes",junkdrawer.serializeList(list), -150);
}
function radio(streamUrl) {
var zender = document.getElementById("player");
zender.innerHTML = '<object id="MediaPlayer" width="278" height="55" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" standby="MegaTunes.Net is loading..." type="application/x-oleobject"><param name="Filename" value="' + streamUrl + '"><param name="ShowControls" value="1"><param name="ShowDisplay" value="0"><param name="ShowStatusBar" value="1"><param name="AutoSize" value="0"><param name="Volume" value="1"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/" filename="' + streamUrl + '" src="' + streamUrl + '" name="MediaPlayer" showcontrols="0" volume="0" showdisplay="0" showstatusBar="0" width="250" height="60"></embed></object><br />';
}
window.onload = function()
{
//script 1
junkdrawer.restoreListOrder("boxes");
//script 2
dragsort.makeListSortable(document.getElementById("boxes"),saveOrder);
//extra..
//script 3
loadNewBumpinSideBarWidgetWithoutPeopleList({ height: "300", width: "200", language: "English", color_string: "", color_theme: "default", enable_login: "true", bumpin_policy: "domain", bumpin_url: "", widget_title: "Shoutbox", enable_guest_login: "true", show_people_list: "true", enable_sound: "true", nick_name: "" });}
}
//-->
</script><!--einde sleepsysteem -->
<!-- Begin sleepsysteem -->
< script language= "JavaScript" type= "text/javascript" >
<!--
var dragsort = ToolMan.dragsort ( ) ;
var junkdrawer = ToolMan.junkdrawer ( ) ;
var rnd = Math.random ( ) ;
function saveOrder( item ) {
var group = item .toolManDragGroup ;
var list = group.element .parentNode ;
group.register ( 'dragend' , function ( ) {
ToolMan.cookies ( ) .set ( "list-boxes" , junkdrawer.serializeList ( list) , 150 ) ;
} )
}
function restoreradio( ) {
var list = document.getElementById ( "boxes" ) ;
ToolMan.cookies ( ) .set ( "list-boxes" , junkdrawer.serializeList ( list) , - 150 ) ;
}
function radio( streamUrl) {
var zender = document.getElementById ( "player" ) ;
zender.innerHTML = '<object id="MediaPlayer" width="278" height="55" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" standby="MegaTunes.Net is loading..." type="application/x-oleobject"><param name="Filename" value="' + streamUrl + '"><param name="ShowControls" value="1"><param name="ShowDisplay" value="0"><param name="ShowStatusBar" value="1"><param name="AutoSize" value="0"><param name="Volume" value="1"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/" filename="' + streamUrl + '" src="' + streamUrl + '" name="MediaPlayer" showcontrols="0" volume="0" showdisplay="0" showstatusBar="0" width="250" height="60"></embed></object><br />' ;
}
window.onload = function ( )
{
//script 1
junkdrawer.restoreListOrder ( "boxes" ) ;
//script 2
dragsort.makeListSortable ( document.getElementById ( "boxes" ) , saveOrder) ;
//extra..
//script 3
loadNewBumpinSideBarWidgetWithoutPeopleList( { height: "300" , width: "200" , language: "English" , color_string: "" , color_theme: "default" , enable_login: "true" , bumpin_policy: "domain" , bumpin_url: "" , widget_title: "Shoutbox" , enable_guest_login: "true" , show_people_list: "true" , enable_sound: "true" , nick_name: "" } ) ; }
}
//-->
</ script><!-- einde sleepsysteem -->
Gesponsorde links
Je moet ingelogd zijn om een reactie te kunnen posten.