3 Replies - 1122 Views - Last Post: 25 February 2013 - 12:14 AM

#1 cam0988  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 13-September 12

multiple body onload

Posted 24 February 2013 - 10:16 PM

Hi,

I have a form that is contained within a lightbox which is displayed on click
function dialogueBox(name){
document.getElementById(name).style.display='block';
document.getElementById('fade').style.display='block';
google.maps.event.trigger(map, "resize");
}

function closeDialogue(name){
	
	document.getElementById(name).style.display='none';
	document.getElementById('fade').style.display='none'
}



this lightbox also contains a google map.

How can I have this lightbox automatically appear after form submit reloads the page?
I have tried putting the function in body onload however maps requires that body onload="initialize()" and I can only get one or the other to work.
I have also tried:
<script>
window.onload = function(){
              initialize();
              dialogueBox(contact);
}


however only the top one will work.

Its been frustrating me all day, it seems so simple however I can't get anything to work.

Any help would be amazing.

thankyou

Is This A Good Question/Topic? 0
  • +

Replies To: multiple body onload

#2 raghav.naganathan  Icon User is offline

  • Perfectly Squared ;)
  • member icon

Reputation: 408
  • View blog
  • Posts: 1,440
  • Joined: 14-September 12

Re: multiple body onload

Posted 24 February 2013 - 10:55 PM

Well, I have a suggestion...try this out and see if it works.
function init()
  {
   dialogbox(contact);
  }
onload = init;

regards,
Raghav

This post has been edited by raghav.naganathan: 24 February 2013 - 10:55 PM

Was This Post Helpful? 0
  • +
  • -

#3 cam0988  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 13-September 12

Re: multiple body onload

Posted 24 February 2013 - 11:00 PM

Thanks Raghav,
excuse my ignorance,
However how does this call the initialize() function required for google maps?

thankyou

campbell
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3371
  • View blog
  • Posts: 11,420
  • Joined: 12-December 12

Re: multiple body onload

Posted 25 February 2013 - 12:14 AM

<script>
window.onload = function(){
              initialize();
              dialogueBox(contact);
}

Unless you have defined a variable named contact then the above code will generate an error when dialogueBox() is executed:

<script>
window.onload = function(){
              initialize();
              dialogueBox('contact');
};

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1