You are here: DEVPPL Forum Programming JavaScript Forum
NOTIFICATIONS
54.335
MEMBERS
15.720
TOPICS
62.409
POSTS
  562
FLASH GAMES
7.740
TUTORIALS
 

Login

E-mail:
Password:

Passing to a Function

0

Loading

Passing to a Function

Postby Hiyatran » Fri Sep 23, 2011 8:44 am

How do I pass an id to a function??
Or is this even possible.

Code: Select all
<html>
<head>
<title></title>
<script type="text/javascript">

function init(){
   display(addText1);
   display(addText2);
   display(addText3);
   display(addText4);
}

function display(var myText){
  var newText = '<h2>' + "Will this change anything..." + '</h2>';

   document.getElementById('myText').innerHTML = newText;
}
</script>
</head>
<body onload="init()">

<div id="addText1"></div>
<div id="addText2"></div>
<div id="addText3"></div>
<div id="addText4"></div>
</body>
</html>
Hiyatran
 
Reputation: 0
Posts: 18
Joined: Mon Jun 21, 2010 2:53 am
Highscores: 0
Arcade winning challenges: 0

Passing to a Function - Sponsored results

Sponsored results

Login to get rid of ads

 

^ Back to Top