Title: Insert javascript into page
Last modified: August 18, 2016

---

# Insert javascript into page

 *  [kakic33](https://wordpress.org/support/users/kakic33/)
 * (@kakic33)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/insert-javascript-into-page/)
 * hello
    i’d like to insert a javascript in a page (not in a post) and i don’t 
   find how to do it It works in a html page.. I try to insert the code the header.
   php and the form code in the “page” and it doesn’t work
 * Thanks for help
    Here ‘s te full script code
 * <script language=”JavaScript”>
    <!–
 * var dannee=-1, dmois=-1, djour=-1, dheure=-1, dminute=-1
    var compDat = new Date(“
   May 29, 2004 20:22:33”) var msparan = 365.25 * 24 * 60 * 60 * 1000 var msparmois
   = 31 * 24 * 60 * 60 * 1000 var msparjour = 24 * 60 * 60 * 1000 var msparheure
   = 60 * 60 * 1000 var msparmn = 60 * 1000 var msparsec = 1000 function calculage(){
   var daten = new Date() var changeA = dannee var changeJ = djour var changeH =
   dheure var changeM = dminute var diffMs = daten.getTime() – compDat.getTime()
   dannee = Math.floor(diffMs / msparan) diffMs -= dannee * msparan djour = Math.
   floor(diffMs / msparjour) diffMs -= djour * msparjour dheure = Math.floor(diffMs/
   msparheure) diffMs -= dheure * msparheure dminute = Math.floor(diffMs / msparmn)
   diffMs -= dminute * msparmn var diffSecs = Math.floor(diffMs / msparsec) if(changeA!
   =dannee) document.forms[0].ans.value=dannee if(changeJ!=djour) document.forms[
   0].jours.value=djour if(changeH!=dheure) document.forms[0].heures.value=dheure
   if(changeM!=dminute) document.forms[0].mins.value=dminute document.forms[0].secs.
   value=diffSecs timerID = setTimeout(“calculage()”,1000) }
 * function MM_preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p)
   d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i
   =0; i<a.length; i++) if (a[i].indexOf(“#”)!=0){ d.MM_p[j]=new Image; d.MM_p[j
   ++].src=a[i];}} } //–> </script>
 * and the form i try yo insert in my page
 * <form>
    <div align=”center”><font color=”#000000″ size=”3″ face=”Comic Sans MS”
   >Salut vous ne le savez peut etre pas mais j’ai <input type=”hidden” name=”ans”
   size=”2″ onFocus=”this.blur()”> <input type=”text” name=”jours” size=”2″ onFocus
   =”this.blur()”> jours <input type=”text” name=”heures” size=”2″ onFocus=”this.
   blur()”> heures <input type=”text” name=”mins” size=”2″ onFocus=”this.blur()”
   > minutes <input type=”text” name=”secs” size=”2″ onFocus=”this.blur()”> secondes
   </font></div> </form>

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [carthik](https://wordpress.org/support/users/carthik/)
 * (@carthik)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/insert-javascript-into-page/#post-162251)
 * Does the page use the appropriate header when it is created? looking at the source
   of the generated page should help you find out the problem.
 *  Thread Starter [kakic33](https://wordpress.org/support/users/kakic33/)
 * (@kakic33)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/insert-javascript-into-page/#post-162459)
 * it ‘s ok
    The way to find my error with reading source was “radical”
 * i forget a tag in the body tag
    thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Insert javascript into page’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [kakic33](https://wordpress.org/support/users/kakic33/)
 * Last activity: [21 years, 2 months ago](https://wordpress.org/support/topic/insert-javascript-into-page/#post-162459)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
