2 Replies - 1102 Views - Last Post: 12 December 2009 - 01:41 PM

#1 yubajefffries   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-December 09

can't get JavaScript to open page on onload command

Post icon  Posted 07 December 2009 - 01:01 PM

I am having issues trying to get the javascript to load when I load the page. I had it before and lost the file now I can't seem to get it again. Here is my code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<title>Wheeler Insurance - Customer Survey</title>
<body onload="java script:View Survey();">
<script language="javascript" type="text/javascript"><!--
var PDF_surveyID = '095504C919339503';

 var PDF_openText = 'View Survey';
// --></script>
<script type="text/javascript" language="javascript" src="http://www.polldaddy.com/sPro.js"></script>
<noscript>&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;a href="http://surveys.polldaddy.com/s/095504C919339503/" mce_href="http://surveys.polldaddy.com/s/095504C919339503/"&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;View Survey&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;/a&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;</noscript>

Is This A Good Question/Topic? 0
  • +

Replies To: can't get JavaScript to open page on onload command

#2 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5239
  • View blog
  • Posts: 14,035
  • Joined: 18-April 07

Re: can't get JavaScript to open page on onload command

Posted 07 December 2009 - 10:04 PM

If you are trying to have it launch into the survey as soon as the page loads, try this as your body tag....

<body onload="java script:PDF_launch(PDF_surveyID);">

This tells the PDF launching script you have installed there to launch using the ID you have provided. Now when a user visits the page, it launches straight into the survey. Hope that is what you were looking to do. Enjoy!

Was This Post Helpful? 1
  • +
  • -

#3 forest51690   User is offline

  • D.I.C Regular
  • member icon

Reputation: 58
  • View blog
  • Posts: 340
  • Joined: 20-March 09

Re: can't get JavaScript to open page on onload command

Posted 12 December 2009 - 01:41 PM

The first error I see in your code is the function name in your body tag:
<body onload="java script:View Survey();">

the function name cannot have any spaces and the java script: prefix is not necessary unless in urls, so it should be this:
<body onload="viewSurvey();">

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1