html - Particularity of parameter for javascript -


i have little question. if had :

<td id="1003212" class="tabg_numof donneesof 1003212" value="1003212" onclick="onclick_celluleid(1003212);"> 

and other :

<td id="comp1003254" class="tabg_composant donneesof 1003254" value="310049063 omni serge f915 grege hdb l1920" onclick="onclick_cellule(310049063omnisergef915gregehdbl1920);"> 

why next function doesn't work second work first ?

function onclick_cellule(t) {             alert(t); } 

? thanks

because 310049063omnisergef915gregehdbl1920 cause syntax error. guess intended string (notice quotes):

onclick_cellule("310049063omnisergef915gregehdbl1920"); 

literal values in javascript can of type string, number, boolean, array, object, null or undefined. value not parse of them, causes error. string literals must surrounded quotes, in fixed example above passing string literal function.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -