javascript Q:
1
Name:
Anonymous
2011-10-21 20:08
is there anyway to do like
var breakln = 'document.writeln("<br />")';
breakln;
and have it actually insert a new line?
also google was of no help for this question and not much help for the next
how the fuck do i pass by reference?
2
Name:
Anonymous
2011-10-21 21:56
If you aren't trolling. you would have to wrap the code in a function, like:
var breakln = function() {
document.writeln("<br/>");
};
breakln();
3
Name:
Anonymous
2011-10-21 21:58
var terpri = function(){
document.writeln("<br />");
};
Use as: [code] terpri();[code]
4
Name:
cocks
2011-10-21 21:58
var terpri = function(){
document.writeln("<br />");
};
Use as: terpri();
5
Name:
Anonymous
2011-10-22 12:32
was trying to do it without functions... guess it can't be helped
6
Name:
Anonymous
2011-10-22 12:43
>>5
You can't do anything without functions.
7
Name:
Anonymous
2011-10-22 13:32
Who the fuck uses document.write() nowadays
8
Name:
Anonymous
2011-10-22 13:32
you want "breakln;" to be a meaningful statement with side effects in JS? What the hell language are you comin from son?
9
Name:
Anonymous
2011-10-22 14:33
10
Name:
Anonymous
2011-10-22 15:19
You can use BreakLn(); just like you would use BreakLn;
They're interchangeable.
11
Name:
Anonymous
2011-10-22 15:23
Don't use document.write for serious development. It triggers premature DOMReady/DOMContentLoaded in the Internet Explorer family.
12
Name:
Anonymous
2011-10-22 15:56
( ˃ ヮ˂)
13
Name:
Anonymous
2011-10-22 16:02
>>11 `
>2011
>using Internet Explorer
14
Name:
Anonymous
2011-10-22 16:40
You're now watching two strangers discuss your question!
Question to discuss:
What does ``love-coloured'' mean?
Stranger 1: covered in blood
Stranger 1: and sperm
Stranger 1: and piss
Stranger 2: correct
Stranger 1: and salyva
Stranger 2: sometimes shit
Stranger 1: and aids and herpes and gonhoria
Stranger 1: yes shit
Stranger 1: delicious shit
Stranger 1 has disconnected
15
Name:
Anonymous
2011-10-22 16:46
>>13-14
Get the fuck out.
16
Name:
Anonymous
2011-10-22 16:59
document.body.appendChild(document.createElement('BR'))
17
Name:
Anonymous
2011-10-22 18:44
>>16
document.createElement('br').innerHTML = 'GIB MONIES?'
18
Name:
Anonymous
2011-10-23 19:27
use cofee script
19
Name:
Anonymous
2011-10-23 22:43
javascript
use python
20
Name:
Anonymous
2011-10-23 23:20
python
Use Lisp
21
Name:
Anonymous
2011-10-24 1:24
var breakln = 'document.writeln("<br />");';
eval(breakln);
But I'm trolling, so you probably shouldn't do that.
22
Name:
Anonymous
2011-10-24 1:29
>>10
Only when using new. BreakLn is just a reference, the parens are required to actually execute the function.
23
Name:
Anonymous
2011-10-24 3:34
use node.js
24
Name:
Anonymous
2011-10-24 3:40
functions are first class, dummy. You can assign them to variables and/or pass them as arguments. But if you must do it your way:
eval('(' + (function() {
// your retarded code goes in here
document.write('line 1');
breakln;
document.write('line 2');
}).toString().replace('breakln', "document.write('\\n')") + ')()');
25
Name:
Anonymous
2011-10-24 5:42
26
Name:
Anonymous
2011-10-24 6:26
>>24
What is up with the eval?
27
Name:
Anonymous
2011-10-24 8:06
>>26
code = (function () { ... }).toString();
code_with_breakln_replaced = code.replace('breakln',"document.write('\\n')");
eval('('+code_with_breakln_replaced+')()');